Skip to content

Instantly share code, notes, and snippets.

@kai101
kai101 / rect_cool_effect.js
Created February 9, 2019 10:47
this is a cool effects from a website. the variable does not make sense but should in most website.
(function() {
function a(a, b, c) {
return a.getAttribute(b) || c
}
function b(a) {
return document.getElementsByTagName(a)
}
function c() {
@kai101
kai101 / hard.md
Last active January 10, 2019 15:23
Problem set

Collection of problem occur along development

  • Redux store with generic reusable component binding.

    • Five generic components with handles to dispatch action.
    • how does reducer know which which component should receive the new action state.
  • Learnt performance impact of redundant rendering when redux refresh.

    • Have more small component connect with store rather than a few giant component connect with store
    • Reduce rerender of many component when one of the reducer change when many small component connected with store.
  • Need flatter architecture for redux to work.
@kai101
kai101 / express_path_cheatsheat.MD
Created November 20, 2018 03:05
How to set Express Route Path?

How to set Express Route Path?

Express path is a powerfull tools to form simple RESTFULL to complex routing for HTTP request. This document will try to capture all usefull express path.

Common

User ID with numeric number

// example: http://example.com/user/331
'/user/:id(\\d+)'
@kai101
kai101 / setup.md
Last active April 5, 2018 04:07
How to setup a new Mac 2018

MAC setup

This is a simple flows for setting up mac.

Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

iTerm2

brew cask install iterm2

@kai101
kai101 / readme.md
Last active March 2, 2018 04:18
Fix certbot braking updates for early 2018

Install certbot

sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
sudo certbot --authenticator standalone --installer nginx -d www.example.com --pre-hook "service nginx stop;sleep 5;" --post-hook "service nginx start;sleep 5;"

Auto renew cronjob

@kai101
kai101 / readme.md
Last active February 13, 2018 01:19
Rsync over shared connection.

Yes, see the ControlMaster and ControlPath options.

You can start the master connection with:

mkdir ~/.ssh/ctl
ssh -nNf -o ControlMaster=yes -o ControlPath="$HOME/.ssh/ctl/%L-%r@%h:%p" user@host

And then use rsync with:

rsync -e "ssh -o 'ControlPath=$HOME/.ssh/ctl/%L-%r@%h:%p'" ...
@kai101
kai101 / readme.md
Created January 30, 2018 02:24
How to install phantomjs 17.10

Using phantom js to render a html page into pdf/image.

sudo apt-get install phantomjs

fixing

QXcbConnection: Could not connect to display
@kai101
kai101 / wkhtmltopdf.md
Last active August 24, 2023 09:10
How to Install Wkhtmltopdf 12.4 with patched Qt?

How to Install Wkhtmltopdf 12.4 with patched Qt?

For earlier version whos suffering from versionlock syndrome. Please follow the instructions to rollback to older SSL interface. Do not alarm by the fallback ssl interface, they received security patches for vulnerability discovered.

Current version of apt-get wkhtmltopdf does not come with Qt patch. There are some issue going with both Qt patched and non-patched. Most common use case is compatible with the patched Qt.