Skip to content

Instantly share code, notes, and snippets.

View timonwong's full-sized avatar
😶

Timon Wong timonwong

😶
View GitHub Profile
@timonwong
timonwong / confluence-navbar-fix.user.js
Last active June 8, 2022 06:39
Confluence NavBar Fix
// ==UserScript==
// @name Confluence NavBar Fix
// @name:zh-CN Confluence导航按钮修复
// @description Fix missing NavBar Button
// @description:zh-CN 修正 Confluence 消失的导航条和导航按钮
// @namespace https://theo.im
// @version 0.1.1
// @license MIT
// @author Timon Wong
// @match *://confluence.alauda.cn/*
@timonwong
timonwong / mysqldump.py
Created February 27, 2015 01:46
django mysqldump management command
# -*- coding: utf-8 -*-
import os
import sys
from optparse import make_option
from django.core.management.base import BaseCommand
from django.core.management.base import CommandError
from django.db import connections
from django.db import DEFAULT_DB_ALIAS
from django.db.backends import BaseDatabaseClient
@timonwong
timonwong / gist:6570051
Created September 15, 2013 11:48
Batch convert to .spx (through ffmpeg)
# -*- coding: utf-8 -*-
import os
import subprocess
import logging
import multiprocessing
import shutil
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
@timonwong
timonwong / gist:eb45ca8b90128f0d49d2
Created May 14, 2015 08:05
Ubuntu 14.04 mirror using aliyun
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

Keybase proof

I hereby claim:

  • I am timonwong on github.
  • I am timonwong (https://keybase.io/timonwong) on keybase.
  • I have a public key ASDs1Y4E2mfuVF9a2pO59hFeVhVC6R8ZkGl_1eLxqkpunQo

To claim this, I am signing this object:

@timonwong
timonwong / naive_mem_pool.cc
Created July 30, 2013 02:06
弱爆的内存池实现
// g++ -std=c++11
#include <cstdio>
#include <new>
#include <vector>
using std::size_t;
using std::vector;
using std::bad_alloc;
// 固定大小内存池, 非常基本的演示
diff -urN --strip-trailing-cr libao-1.1.0-orig/configure libao-1.1.0-gd/configure
--- libao-1.1.0-orig/configure 2011-02-23 00:30:22 +0800
+++ libao-1.1.0-gd/configure 2013-05-12 08:53:47 +0800
@@ -173,6 +173,14 @@
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+
+ test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
#!/bin/sh
./configure \
--prefix=$PREFIX \
--build-suffix=-gd \
--enable-memalign-hack \
--enable-runtime-cpudetect \
--enable-shared \
--disable-static \
--disable-debug \
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
name.txt
O Efeito do Verão.mp3
"""
name = open('name.txt').read().strip()
@timonwong
timonwong / gist:4671209
Created January 30, 2013 06:35
ST2: Missing C# .tmPreferences file for comments
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.cs</string>
<key>settings</key>
<dict>