This's my personal wiki (brain dump), detailing almost everything I know.




  1. Update dotfiles.
  2. Update repo.


Tested on sublime text, high memory usage so turned off local usage. More tests required.


I'm working through Elements of Programming Interviews. My plan is to get through most of the problems in about a year.

I'm starting to see some patterns with problems, which is a good thing.

My github repo: here


Change password to password

Edit /etc/shadow on SD card, change the hashed password to



Special characters in file names

- is recognized as stdin, so use ./- for checking filenames beginning with -.

Use "hello world" when names contain spaces.

IO redirection

Note: Basic file descriptor (fd) for shell's operation are 0 for STDIN, 1 for STDOUT, 2 for STDERR.

I used this code for OverTheWire Bandit 25.


# Link fd3 to localhost:30002 bidirectional
exec 3<>/dev/tcp/localhost/30002	
# Print out first line from fd3
head -1 <&3							


for i in {0000..9999}
    answer="${old_password} ${i}"
    # Send to fd3
    echo $answer >&3				
    response=$(head -1 <&3)
    if ! [[ $response =~ "Wrong" ]]
        echo $i

# Reset fd3 to normal
exec 3>&-


No spaces between =, ie. x=23. String interpolation uses ${}.

z="${x} ${y}"


Use nc to create a server/client to send tcp.

# Server
nc -l 1234
# Client
nc localhost 1234



Positive numbers have leading 0, negative numbers have leading 1.

# TODO think about this, don't understand why atm
-x = complement(x-1)


A function either returns something or mutate arguments. Probably put 'mutate' in docstring just in case.


npx create-react-app some-app

Ref: github bug

I'm using Win 10 and the username has a space (V L).

C:\Users> dir /x    # got VL~1

npm config edit and add cache=C:\Users\VL~1\AppData\Roaming\npm-cache to config file.


I'm using Ansible playbook to automate setting up vps.



  • security
  • wireguard
  • pihole


A few personal projects.



3DS has a built-in feature StreetPass which lets nearby users to exchange data from games and applications. This is great if you live in a big city where there are a lot of 3DS devices. However, if you live in a small town, you would be lucky to just get a handful of streetpasses monthly.

StreetPass Relay

Due to that, Nintendo introduced another feature called StreetPass Relay. Every 3DS device has a whitelist of public wifi AP which it can automatically connect to. If connected, some data will be sent and stored on Nintendo server. When another 3DS user connects to the same AP, Nintendo server will send the stored data to the latter device. Consequently, 3DS devices don't have to be in close proximity to exchange data.

The whitelist contains the SSID and MAC of public wifi AP. Thus, some nice people figured out ways to create homemade StreetPass relays by spoofing MAC and SSID1. The basic idea to create a public wifi AP with the same SSID and MAC as in the whitelist.

For Raspberry Pi, there is SpillPass-Pi2 which work automatically when you plug in. You only need a wifi dongle wlan0 which support mac spoof and a wired internet connection eth0.

My setup is slightly different because I don't have a wired connection to the home router. What I have is 2 wifi dongles, wlan0 and wlan1. The idea is still the same, but instead of eth0 bridge to wlan0, I have wlan1 connected to the internet and wlan0 as wifi AP. All the traffic are forwarded to/from wlan0 to wlan1.


I used Raspbian Jessie Lite image. I don't have external keyboard or monitor so desktop on Raspberry Pi is unnecessary. Installed the image on the SD card by either dd or Etcher, then added your wifi network to /etc/wpa_supplicant/wpa_supplicant.conf.2


Updated and installed softwares:

sudo apt update && sudo apt upgrade
sudo apt -y install hostapd dnsmasq haveged iptable-persistent sqlite3

I used this wonderful guide to setup forwarding.


Set wlan0 to a static ip address

auto lo
iface lo inet loopback

iface eth0 inet manual

# AP
allow-hotplug wlan0
iface wlan0 inet static

# wireless
allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Tell DHCPCD to ignore wlan0.

denyinterfaces wlan0


Hostapd is an user daemon to start up AP. In /etc/default/hostapd, uncomment or add the line DAEMON_CONF=/etc/hostapd/hostapd.conf.

#sample hostapd.conf
#overwrite by






You can test if AP is working by running sudo hostapd /etct/hostapd/hostapd. You should be able to see attwifi.

I use dnsmasq to map IP addresses to MAC addresses. When 3DS connect to my hotspot, it will be assigned a dynamic IP address. It is also possible to bind 3DS MAC address to a static IP address.


Port forwarding

In /etc/sysctl.conf, uncomment net.ipv4.ip_forward=1.

sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
sudo iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o wlan1 -j ACCEPT
sudo sh -c 'iptables-save > /etc/iptables/rules.v4'

Start services sudo service hostapd start && sudo service dnsmasq start. Reboot Raspberry Pi and test if attwifi can be connected to the internet.

systemd service and timer

I use systemd to run my at boot time and the script will rerun every 5 minutes to change wlan0 to new SSID and MAC.



Description=Run homepass.service every 5 minutes



Enable the timer by executing this command

systemctl enable homepass.timer
systemctl start homepass.timer

A nice feature of using systemd to run the script is we can access the logging easily for debugging

journalctl -u homepass

This script was modified from orginal script by Semperverus. You can check out his guide for more details about HomePass. I took the idea of using sqlite3 to store MAC and SSID in a database from danielhoherd's script.

The script is rerun every 5 minutes by systemd. It stops current running hostapd service. A new /etc/hostapd/hostapd.conf is generated from querying MAC and SSID from a database. The hostapd service is then restarted with the new conf file.

service hostapd stop


if [[ ! -e "$CONFIG_FILE" ]] ; then
  touch "$CONFIG_FILE"

read -d '' query << EOF
SELECT mac, ssid
FROM aps
WHERE last_used < datetime('now', '-2 days') OR last_used IS NULL
ORDER BY random()

result=$(sqlite3 "$DB" "$query")
resultArr=(${result//|/ })


if [[ -z "$MAC" ]] || [[ -z "$SSID" ]] ; then
  echo "missing MAC or SSID"
  exit 1

sqlite3 "$DB" "UPDATE aps SET last_used = datetime('now') WHERE mac = '$MAC'"






echo "==========================================="
echo "SSID:" $SSID "- BSSID:" $MAC
echo "Time before next change:" $SLEEP_TIME "seconds"
echo "Current time:" $(date)
echo "==========================================="

service hostapd start

All files

You can find all my files at my github repo.


Gaming is my hobby to pass the time.

Those days I mostly play mobile gatcha games instead of pc games. I usually purchase monthly packages so I'm not a f2p player. I used to balk at the idea of paying monthly subscription to MMOs, but now I do it without blinking for mobile games.


Girls' Frontline

Guns as anime girls.

July 31 2020

I finished the Isomer ranking map with 606k scores. It was good enough to get the exclusive fairy so I had no intention of retrying.

It was a bad day for me mentally; I felt overwhelmed all day. I cried when I made a bunch of mistakes microing the game. I ate a whole box of ice cream for dinner.

SF capture

It's coming to EN server; I really hope it isn't too much p2w.


Tower defense with anime girls and some males.


Persona 4 Golden

I started playing Persona 4 back in 2008; I lost my save so never finished it. As the game came to PC, I finally had the chance and motivation to restart and beat it.

The gameplay is great, I'd describe it as traditional turn based JRPG combined with dating sim. IMO the story does overstay its welcome, the beginning feels too long and there are lot of downtimes in the middle. Moreover I prefer darker theme of Persona 3 to Persona 4. Persona 4 is still a great game though.

I got the golden ending on 7/5/2020. I'm missing a few achievements; I am not a completionist so I don't feel like starting new game + any time soon.

Thanks to the game, I became a longtime fan of SMT series and Atlus. I imported Demon's Souls, SMT: Strange Journey and SMT: Devil Survivor to UK when I was in college. Funny enough, I also lost my save to Strange Journey; maybe one day I'll attempt to complete Strange Journey Redux.

Monster Train

I'm a big fan of Slay the Spire and the former game scratches the same itch. It combines deck building with tower defense, which are pretty cool.

I got to covenant 25 so I'm taking a break from the game.

Horizon Zero Dawn

The story is ok; I zoned out a lot during the cut screens. I skipped a bunch of side quests as the game started to become a chore.

The gameplay is pretty fun, rolling around and shooting weak points on machines. At the beginning stealth was important as my weapons were limited. By the end of the game, I resolved to use explosives for everything.


I'm reading

  • Reverend Insanity: evil MC, cultivation story.
  • Lord of the Mysteries: steampunk setting, cool story. The first 100 chapters are tedious, but it keeps getting better after that.
  • Kumo: Japanese reincarnation light novel.
  • Tearmoon Empire: finished second book. Fun light-hearted story; misunderstanding - the story.
  • Bakarina: reading volume 3. It's not as good as the first 2 books.


I'm watching:

  1. Doom Patrol season 2.
  2. Hololive. I watched a couple of Kizuna Ai videos a few years ago then completely forgot about the whole things. On August 2020, I did a quick google to see what is going on with her channel and found out about the new company, VA changes... Youtube started to recommend me some Hololive clips; a few days later I began to watch them live. I like the detective, reaper and princess; they're ok in my book.
  3. HealthyGamerGG. I started watching the channel after Reckful. I've been trying meditation and improving myself and it's a daily struggle.


The Platform

I really like the movie and its social commentary. It reminds me of the sayings 'Where you stand depends on where you sit.' and 'Pick your battles.'. I heard of them a lot around 2008 during the financial crisis.

Personally I deliberately and subconsciously choose to be ignorant on many topics. Maybe one day I'll educate myself on them.


This isn't investment, it's pure speculation at best and gambling at worst.


I feel alive testing my hypotheses, regardless of wins or losses.

Financial Responsibility

I've a separate retirement account and a fun account. The former account is invested in boring ETFs and bonds to hold forever. As for the latter, it isn't a big deal if I lost it all.

I also only allocate a few percentages of my portfolio for every risky play. So a single loss won't wipe my entire account. On the flip side, I'm not going to get rich any time soon.

I followed /r/wallstreetbets and it has been a wild ride. Sometimes I win, sometimes I lose; at least my account is still positive. I got burnt playing naked options so I don't want to touch them for now.


Beware: Survivor Bias belows.

UPRO/TMF 55/45

I found about this through the subreddit; it was originally posted at bogleheads. I invested most of my fun account into this play at the beginning of 2020.

In March 2020, it was down by 30%. Luckily I didn't abandon the strategy and I also kept buying UPRO as it went down. I also did some re-balancing during that time, sold TMF and bought UPRO.

Since then, it has steadily recovered. As of September 2020, it was about 15% up.


I saw the posts about the mattress company on subreddit at the end of July 2020. They had sound arguments and data to back them up, at least to my ears anyways. It was down more than 30% after earning but had recovered since.

  • August 2020: bought 100 at $24.72, sold covered calls.

Profit: 10.89% (269.14/2,472) from calls.

Plan: I shorted covered call 25C 10/16 and I plan to let the shares be called.


First time I've ever heard and invested into SPAC. Bill Ackman is behind this so it has a lot of hype going.

  • July 2020: bought 189 at $21.82.
  • September 2020: did some swing trades when price was round $22, sold all warranties.

Profit: 3.85% (174.09/4520.88)

Plan: pray for good news about the targeted mature unicorn.


I've high hope of it as the same management team of SHLL is behind this SPAC.

September 2020: bought 100 at $10.54.

Plan: may buy more


I want to buy and hold FAANG shares. FB seems like the cheapest out of them.

September 2020: bought 10 at $281.27.

Plan: long term hold for now.


Compared to myself 8 years ago, I'm at a better position mentally. There have been a lot of ups and downs and it'll be the same going forward.

I plan to use this page to figure my thinking patterns and hope to better understand my brain.


I like taking a long hot shower. I think too much while showering though; I caught myself a lot of times forgetting whether I've used shampoo or not.