Skip to content

Instantly share code, notes, and snippets.

View houtianze's full-sized avatar

Hou Tianze houtianze

View GitHub Profile
"basics": {
"name": "Hou Tianze",
"label": "Full Stack Developer",
"picture": "",
"email": "",
"website": "",
"summary": "I enjoy creating things, solving problems and learning new skills. Software development makes those achievable at one's fingertips, that's why I like it.",
"location": {
"city": "Singapore",
houtianze /
Last active April 8, 2022 01:29
Apache Mina SSH Server
package com.example;
houtianze /
Created March 4, 2018 07:38
Shrink docker.qcow2 (which can get verylarge) on macOS

docker/for-mac#371 (comment)

If you can remove all images/containers then:

Stop Docker.

docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls |awk '{print $2}')
rm -rf ~/Library/Containers/com.docker.docker/Data/*
houtianze /
Last active January 7, 2018 12:06
getch() / getche() for Python
if sys.platform == 'win32':
import msvcrt
getch = msvcrt.getch
getche = msvcrt.getche
import sys
import termios
def __gen_ch_getter(echo):
houtianze / powermode.user.js
Last active August 1, 2018 22:49
Power Mode TamperMonkey Script
// ==UserScript==
// @name Power Mode!
// @namespace
// @updateURL
// @version 0.1.1
// @description Turn on Power Mode!
// @author ibic
// @match *://*/*
// @exclude *://*
// @grant none
houtianze / homebridge
Last active April 23, 2019 13:59 — forked from johannrichard/homebridge
Systemd Service for homebridge (
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
// Source:
class Monster {
// A method named "constructor" defines the class’s constructor function.
constructor(name, health) {
// public name object = name;
// private name object
this[pHealth] = health;
houtianze /
Last active February 27, 2023 12:45
On Y Combinator

Hopefully this may speed your groking of the forking torturing Y Combinator a little bit.

Disclaimer: I don't assert what I say here is accurate, or even correct (I'm not authorative, obviously), but it's my understanding and I'm sharing in the hope that someone who also struggles on the Y Combinator may benefit a tad.

Prerequisite Understandings

  • In Lambda Caculus, everything is a Lambda Caculus (Anonymous function that takes one parameter). And the best thing is that, ... drump roll ..., it's Turing Complete. So theoretically, it can caculate anything a computer can.
  • In this note, I use the term function, which (I think) means Lambda Caculus, to sound (at least to myself) more accustomed.

The definition of Y Combinator

  • Y = λf.(λx.f (x x)) (λx.f (x x))
I just finally had my mind snap into place with understanding of the Y Combinator.
Most explanations I read, even the ones using JS, didn't make much sense and were
overly long so here follows my own, much simpler explanation. I will be using JS.
We have fibonacci to start with, very simple recursive function.
It's fixed points are 0 and 1, fib(0) = 0, and fib(1) = 1
That's all a fix point means, when the f(x) == x
They are important because they are the only values at which recursion can cease.