Skip to content

Instantly share code, notes, and snippets.

View amorphobia's full-sized avatar
🏠
Working from home

Xuesong amorphobia

🏠
Working from home
View GitHub Profile
@amorphobia
amorphobia / AddToRightClickMenu.reg
Created May 4, 2016 12:20
Adding "Open in Cygwin" to Windows right-click menu
Windows Registry Editor Version 5.00
; copied from https://gist.github.com/niboxy/5c4cc06558e8c84aa785
; edit the path where Cygwin is installed
; change the login shell if bash is not prefered
; edit .bash_profile afterwards
; adding the following code
; _T=${_T//\\//}
; if [[ $_T == "" ]]; then
@amorphobia
amorphobia / config.js
Created May 21, 2016 13:40
Ghost + Nginx + Docker
// # Ghost Configuration
// Setup your Ghost install for various [environments](http://support.ghost.org/config/#about-environments).
// Ghost runs in `development` mode by default. Full documentation can be found at http://support.ghost.org/config/
var path = require('path'),
config;
config = {
// ### Production
#!/usr/bin/env python3
from flask import Flask, jsonify
app = Flask(__name__)
tasks = [
{
'id': 1,
'title': u'Buy groceries',
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
'done': False
@amorphobia
amorphobia / log-2016-05-28_12-43-00.txt
Last active May 28, 2016 04:45
Windows Docker beta 的错误日志
[12:43:00.766][Program ][Info ] Version 1.11.1-beta13 (build: 3441)
[12:43:00.766][Program ][Info ] Starting on: 5/28/2016 12:43:00 PM
[12:43:00.782][Program ][Info ] Resources: C:\Program Files\Docker\Docker\Resources
[12:43:00.782][Program ][Info ] OS: Windows 10 Pro
[12:43:00.782][Program ][Info ] Edition: Professional
[12:43:00.782][Program ][Info ] Id: 1511
[12:43:00.782][Program ][Info ] Build: 10586
[12:43:00.782][Program ][Info ] BuildLabName: 10586.103.amd64fre.th2_release.160126-1819
[12:43:00.797][Program ][Info ] Mixpanel Id: A629D857-B6EC-4723-99B7-7B40F8B766FE
[12:43:00.797][Program ][Info ] Sha1: 5307146e79f6a634960d05da93adc33cf602d1f1
@amorphobia
amorphobia / hash_extended.h
Created May 29, 2016 13:22
Copied from hash_range in Boost.
#ifndef HASH_EXTENDED_H
#define HASH_EXTENDED_H
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
namespace std {
template<typename T> struct hash<vector<T>> {
inline size_t operator() (const vector<T>& vec) const {
class Solution {
public:
int ladderLength(string beginWord, string endWord, unordered_set<string>& wordList) {
// key: string with one of its charactor replaced by '-', e.g. "dog"->"d-g"
// value: vector of such strings
unordered_map<string, vector<string>> dict;
for (string s : wordList) {
for (int i = 0; i < s.length(); ++i) {
string k = s;

Keybase proof

I hereby claim:

  • I am amorphobia on github.
  • I am xuesong (https://keybase.io/xuesong) on keybase.
  • I have a public key whose fingerprint is FC70 55C1 CB91 996D DB83 81A6 C17B DC00 7214 0DFD

To claim this, I am signing this object:

nginx:
container_name: ghost_blog_nginx
image: nginx
ports:
- "80:80"
- "443:443"
volumes:
- ~/Developer/Docker/ghost_blog/html:/usr/share/nginx/html
- ~/Developer/Docker/ghost_blog/nginx:/etc/nginx
links:
@amorphobia
amorphobia / chinese_lunar_1901_2100.ics
Created February 27, 2018 14:34
Chinese lunar calendar 1901 to 2100
This file has been truncated, but you can view the full file.
BEGIN:VCALENDAR
PRODID:-//Chen Wei//Chinese Lunar Calendar//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:农历
X-WR-TIMEZONE:Asia/Shanghai
X-WR-CALDESC:中国农历1901-2100, 包括节气.
BEGIN:VEVENT
DTSTAMP:20180227T141148Z