Jiayu's Blog

Blog subtitle

Rotom Pokédex bot

Lately, I've been playing through some of the older Pokémon games (Pokémon Platinum and Pokémon White), and built a Telegram bot for quickly looking up in-game things like Pokémon weaknesses or ability effects. Send Rotom Pokédex bot (@rotom_pokedex_bot on Telegram) a Pokémon name or number to get a quick summary about it:

Fantasy Premier League daily player statistics dataset

On the Fantasy Premier League website, there's an endpoint called bootstrap-static which returns a JSON document containing data on various parts of the game. The bulk of the data is a list of player objects under the elements key. Each player object contains detailed information about a player, for example:

Sudoku addendum

This is a follow-up from my previous post about writing a simple backtracking sudoku solver. Recently I generated another puzzle on QQWing which was considered easy: ..6..5....9.1.3..5.....27........9..8...6..7.......1.6..358..2.6....1.5..7...96.1 Number of Givens: 25 Number of Singles: 35 Number of Hidden Singles: 21 Number of Naked Pairs: 0 Number of Hidden Pairs: 0 Number of Pointing Pairs/Triples: 0 Number of Box/Line Intersections: 0 Number of Guesses: 0 Number of Backtracks: 0 Difficulty: Easy And yet my solver takes even longer than it needed on the adversarial input:

Solving sudoku

As much as I would like to believe that programming has developed my analytical thinking, I am quite terrible at solving sudoku puzzles, so I decided try writing a sudoku solver instead. Here is a simple backtracking solver written in Python 3:

Create data URLs from the command line

Yesterday, I was trying to replace an image on GitHub with another to mockup something by editing its src attribute in the browser inspector, but it didn't work because GitHub has implemented a Content Security Policy (CSP)1 which only allows images from certain sources:

Conditional Git configuration

The situation Have you ever created a new Git repository for work on a personal machine or vice-versa, and accidentally made your first commit with the global Git email? Something like: $ git config --global user.email my@personal.email $ git init Initialized empty Git repository in /Users/yijiayu/work/project/.

Namespaced Git clones with git-get

tl;dr git-get is a tool for cloning Git repositories into unique, namespaced directories based on the remote URL: yi-jiayu/git-get Clone git repositories into namespaced directories like go get https://github.com/yi-jiayu/git-get Background Last weekend, I was trying to clone a fork of one of my projects on GitHub to check out a pull request locally, when I ran into a small problem: the name was already taken by my original repository.

Custom traces on App Engine Standard

Bus Eta Bot is a Telegram bot for getting bus arrival times from the LTA DataMall API. It is written in Go and hosted on the App Engine standard environment for Go. Stackdriver tracing on App Engine standard In the App Engine standard environment, applications run in a sandboxed environment and are subject to various restrictions and vendor lock-in.

Preventing my Macbook's memory from draining overnight

Twice in the past month, I came back to my (company-issued) MacBook after leaving it with the lid open overnight to find it refusing to start because its battery was completely drained, worrying me a little each time. I wondered why it wasn't going to sleep due to inactivity.

Hot Corners profiles

My company is big on agile, so we're often encouraged to work in pairs. One challenge with pair programming on personal machines is that not everyone might be equally comfortable with the configuration. Ignoring the fact that as a Dvorak keyboard layout user I'm immediately awkward on a teammate's machine, a setting I use on my own machine that my pairs are often not used to is the Hot Corners.