Skip to content

Instantly share code, notes, and snippets.

View MikeChongCan's full-sized avatar

Mike Chong MikeChongCan

  • True North
  • 07:20 (UTC -06:00)
View GitHub Profile
@MikeChongCan
MikeChongCan / Dockerfile
Created December 19, 2016 14:11
Dockerfile - wechaty custom
FROM mhart/alpine-node:7
RUN apk update && apk upgrade \
&& apk add \
bash \
ca-certificates \
chromium-chromedriver \
chromium \
coreutils \
ffmpeg \
package main
import (
πg "grumpy"
π_os "os"
)
func initModule(πF *πg.Frame, _ []*πg.Object) (*πg.Object, *πg.BaseException) {
ßDemo := πg.InternStr("Demo")
ß__metaclass__ := πg.InternStr("__metaclass__")
ß__module__ := πg.InternStr("__module__")
ß__name__ := πg.InternStr("__name__")
@MikeChongCan
MikeChongCan / crawler.js
Created February 12, 2017 23:15
UK city list in json (in both English and Simplified Chinese)
// Open `https://zh.wikipedia.org/wiki/%E8%8B%B1%E5%9C%8B%E5%9F%8E%E5%B8%82%E5%88%97%E8%A1%A8` in Chrome
const regions = [
{
// Eng
id: 0,
table: 7,
},
{
// NI
id: 1,
@MikeChongCan
MikeChongCan / Gemfile
Last active March 31, 2017 08:24
Rails 5 extra gems for WildCat
# Extra gems:
# Simple Rails app configuration
gem 'figaro'
# Easily include static pages
gem 'high_voltage'
# Paginator for Ruby webapps
gem 'kaminari'
# Simplified logger
gem 'lograge'
# File uploader
@MikeChongCan
MikeChongCan / shell
Created May 9, 2017 12:32
Docker host maintenance
# Remove untagged images
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
# Remove images which are not depended by others
docker images -q |xargs docker rmi
# Refs:
# https://forums.docker.com/t/command-to-remove-all-unused-images/20/3
# http://jimhoskins.com/2013/07/27/remove-untagged-docker-images.html
[
{
"cn_name": "巴斯",
"en_name": "Bath",
"region_id": 0,
"id": 1
},
{
"cn_name": "伯明翰",
"en_name": "Birmingham",
@MikeChongCan
MikeChongCan / 1_installation.sh
Last active April 15, 2023 15:08
Set up default rails based VPS (with oh-my-zsh installed)/ install.sh
# set up ssh keys
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
# TODO: set up authorized_keys
chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
# install zsh and oh-my-zsh
sudo apt update && sudo apt-get install -y curl git zsh tmux wget # ripgrep
@MikeChongCan
MikeChongCan / README.md
Created March 9, 2018 11:48
Personal list of AI papers
@MikeChongCan
MikeChongCan / main.sh
Created March 24, 2018 18:26
System network speed monitor (Ubuntu)
sudo apt-get install iftop
@MikeChongCan
MikeChongCan / install-postgres-10-ubuntu.md
Last active August 23, 2018 17:32 — forked from alistairewj/install-postgres-10-ubuntu.md
Install PostgreSQL 10 on Ubuntu

Install PostgreSQL 10 on Ubuntu

This is a quick guide to install PostgreSQL 10 - tested on Ubuntu 16.04 but likely can be used for Ubuntu 14.04 and 17.04 as well, with one minor modification detailed below.

(Important) After installation: Common issues

  1. Getting error: Peer authentication failed for user “postgres”, when trying to get pgsql working with rails: https://stackoverflow.com/questions/18664074/getting-error-peer-authentication-failed-for-user-postgres-when-trying-to-ge
  2. PostgreSQL: role is not permitted to log in https://stackoverflow.com/questions/35254786/postgresql-role-is-not-permitted-to-log-in
  3. In order to gem install pg: apt-get install libpq-dev