Crypto Zombies

- 1 min read

Making the Zombie Factory

Event (event & emit) notificaiton trigger for front-end app, gas related that receving information/data without interacting to the contract

Zombies Attack Their Vicitms

mapping (address => uint) public accountBalance; | mapping (key => value) public accountBalance;

storage vs memory | hardisk vs ram

internal vs external vs public vs private

Advanced Solidity Concepts

OpenZeppelin ownable (modifier onlyOwner)

struct{ uint c; uint32 a; uint32 b;) gas < struct{ uint32 a; uint c; uint32 b;) gas

Nas Docker Rss Subscription Service

- 2 mins read

For me, Freshrss is better.

I plan to test them one by one, but stop at Freshrss as I’m satisfied with it.

Planned testing sequence in order: Miniflux -> Freshrss -> Tiny tiny rss

My requirement:

  • Subscribe > 100 feeds
  • Use on PC & mobile
  • Feeds are manageable (feeds with error, remove feeds)

Comparison:

  • Miniflux

    • can suscribe >100 feeds
    • Easy to use on both PC & mobile
  • Freshrss

    • can subscribe >100 feeds
    • Easy to use on both PC & mobile
    • Better subscription mangement (e.g. remove number of feeds without click them 1 by 1)
    • Better GUI

Docker-compose

Freshrss

version: "2.4"

volumes:
  db:
  data:
  extensions:

services:
  freshrss:
    image: freshrss/freshrss:latest
    container_name: freshrss
    hostname: freshrss
    restart: unless-stopped
    logging:
      options:
        max-size: 10m
    volumes:
      - data:/var/www/FreshRSS/data
      - extensions:/var/www/FreshRSS/extensions
    environment:
      TZ: Asia/Hong_Kong
      CRON_MIN: '3'
      TRUSTED_PROXY: 0
    ports:
        - "8080:80"
    
  freshrss-db:
    image: postgres:16
    container_name: freshrss-db
    hostname: freshrss-db
    restart: unless-stopped
    logging:
      options:
        max-size: 10m
    volumes:
      - db:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: freshrss-db
      POSTGRES_USER: freshrssuser
      POSTGRES_PASSWORD: freshrsspassword
    command:
      # Examples of PostgreSQL tuning.
      # https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
      # When in doubt, skip and stick to default PostgreSQL settings.
      - -c
      - shared_buffers=1GB
      - -c
      - work_mem=32MB

miniflux

version: '3'
services:
  miniflux:
    image: miniflux/miniflux:latest
    ports:
      - "8756:8080"
    depends_on:
      db:
        condition: service_healthy
    environment:
      - DATABASE_URL=postgres://miniflux:miniflux@db/miniflux?sslmode=disable
      - RUN_MIGRATIONS=1
      - CREATE_ADMIN=1
      - ADMIN_USERNAME=admin
      - ADMIN_PASSWORD=password
  db:
    image: postgres:15
    environment:
      - POSTGRES_USER=miniflux
      - POSTGRES_PASSWORD=miniflux
    volumes:
      - miniflux-db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "miniflux"]
      interval: 10s
      start_period: 30s
volumes:
  miniflux-db:

Ethernaut

- 11 mins read

Study Material

Ethernaut, a CTF-like smart contract security challenge writeup

1. Ethernaut0 - Hello Ethernaut

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Instance {

  string public password;
  uint8 public infoNum = 42;
  string public theMethodName = 'The method name is method7123949.';
  bool private cleared = false;

  // constructor
  constructor(string memory _password) {
    password = _password;
  }

  function info() public pure returns (string memory) {
    return 'You will find what you need in info1().';
  }

  function info1() public pure returns (string memory) {
    return 'Try info2(), but with "hello" as a parameter.';
  }

  function info2(string memory param) public pure returns (string memory) {
    if(keccak256(abi.encodePacked(param)) == keccak256(abi.encodePacked('hello'))) {
      return 'The property infoNum holds the number of the next info method to call.';
    }
    return 'Wrong parameter.';
  }

  function info42() public pure returns (string memory) {
    return 'theMethodName is the name of the next method.';
  }

  function method7123949() public pure returns (string memory) {
    return 'If you know the password, submit it to authenticate().';
  }

  function authenticate(string memory passkey) public {
    if(keccak256(abi.encodePacked(passkey)) == keccak256(abi.encodePacked(password))) {
      cleared = true;
    }
  }

  function getCleared() public view returns (bool) {
    return cleared;
  }
} 

1.1 Solution

Starting from contract.info() which redirecting me to a function that change “cleared” to true;