Using docker with ufw
Recently I realized that the personal service server I built literally has every port accessible over LAN. I used docker-compose to build all the services I ran on the server and made sure ufw is enabled and only allow port 22 and port 443/80. During a test with a reboot lock down script, I realized that even I disable all the ports from ufw, these ports are still accessible. After googling, I realized it has something to do with docker’s own iptables rule somehow will take precedent ov...
2020 Review
2020 is an interesting year, although I have made plans to attend Magical Mirai and Miku EXPO, due to the pandemic all of them has been cancelled. The work from home has became a new norm nowdays, and all the travel restrictions has made impossible for anyone to meetup with each other. Achievements Able to finish writing the gameboy emulator Lost weight to sub-80 kg Finished reading 4 books in the yearly plan Made good financial decision on stocks Obtained an PDFT keychip Passed JLPT N2 Stop...
How Pokemon Red implemented flashing stars
I’ve been writing my gameboy emulator in rust and I had a lot of issues getting this startup screen to display properly, later I’ve realized it was achieved using the clever pallet swapping in runtime. For pokemon red, the start screen flashing start is made possible by changing palette during runtime. 12345let palette_num = if sprite.use_palette_1 { self.op1 } else { self.op0 ...
Useful Rust crates
static_assertionshttps://crates.io/crates/static_assertions compile time assertions for rust rusty-forkhttps://crates.io/crates/rusty-fork provide a way to run unit test in “forks” instahttps://crates.io/crates/insta snapshot testing in rust quotehttps://crates.io/crates/quote marco to turn rust syntax tree data structure into token of source code
Sega Nu keychip (part 1)
IntroductionIn the Sega Nu systems, system boot and application start is gated by the mysterious “keychip”. A lot of systems sold online do not include the keychip since they are property of Sega and needed to be returned once the operator terminate contract with Sega. I was lucky enough to find two keychip being auctioned and I want to document my reverse engineering efforts. Hopefull later people are able to use this information to reconstruct keychip for the game they want to launch and ke...
Emulating Gameboy with Rust
It’s been a while since I finished the CHIP-8 emulator, the CHIP-8 emulator was mostly capable of running PONG, but at the end I still haven’t figured out how to get input work correctly. This time I want to try to experiment with the Gameboy, it will be much harder to emulate given the increased number of instructions and a palette. DMG-01 Also known as the “original gameboy” Hardware Overview CPU: Custom 8-bit sharp at 4.19MHZ Resolution: 160*144 Framerate: 59.727hz Memory: 8KiB internal...
Modules in Rust 2018
Modules in Rust 2018https://doc.rust-lang.org/nightly/edition-guide/rust-2018/module-system/path-clarity.html Rust 2015.├── lib.rs└── foo/ ├── mod.rs └── bar.rs Rust 2018.├── lib.rs├── foo.rs└── foo/ └── bar.rs In top level, the same level of the main.rs 123// module.rspub fn some_module_fn() {} Then if you want to add more stuff in the module, helper functions, sub-modules, add them in the folder named the same name as your module. 123// In ./module/shared.rspub...
Arch installer - alis
I start using linux and ditched my Macbook for about 3 years ago. Mainly because Apple kept making Mac OS more and more like a media consuming product and there aren’t any good laptops from them recently. So I moved to linux, the switch to full linux workflow is a bit different but not unfamilar for me. I was able to use most of the software I wanna use for my personal work and entertainment. So I first tried the distro I am most familar with: Homepage: https://ubuntu.com/ Later I had some ...
About Google
Its been a while since I considered the idea of reducing my online footprints. I still remember I started using Google’s service in 2006. At that time, Gmail is not open to registration yet, I remember I had to ask for someone online for an invite. It was a great time to have a @gmail.com account for a 14 year old. Now 14 years has passed, I use so much Google. My email, photo, home automation, videos. I really love the modern internet where everything is seemlessly integrated. Recently I fou...
StyleGAN2 generation with Genome
Previously I have written a simple library called genome using Javascript repo. The idea came to me when I wanted to build something like cryptokittie (crypto cat breeding and trading). I wanted a way to generate random values that can be used to generate random things, also the ability to merge these values. The project is really crude, it basically stores 4 markers and 1 influence as number. When merging two DNA together, there is random change that one gene might mutate. There are 5 type o...














