Skip to content

Instantly share code, notes, and snippets.

@thekoc
thekoc / db.py
Last active January 16, 2021 02:59
import sqlite3
import Queue as queue
def singleton(cls):
instances = {}
def _singleton(*args, **kw):
if cls not in instances:
instances[cls] = cls(*args, **kw)
@thekoc
thekoc / init.lua
Created July 10, 2017 05:16
Hammerspoon configuration file backup
local function hasValue(value, list)
for i, e in ipairs(list) do
if value == e then
return true
end
end
return false
end
local function applicationWatcher(appName, eventType, appObject)
@thekoc
thekoc / 沉默的大多数节选.txt
Created September 9, 2017 03:58
我的师承――《青铜时代序》
我终于有了勇气来谈谈我在文学上的师承。小时候,有一次我哥哥给我念过查良铮先生译的《青铜骑士》:
我爱你,彼得建造的大城
我爱你庄严、匀整的面容
涅瓦河的流水多么庄严
大理石平铺在它的两岸……
@thekoc
thekoc / pmset.log
Last active December 13, 2017 03:22
2017-12-13 01:02:02 +0800 Assertions PID 195(mDNSResponder) Created MaintenanceWake "mDNSResponder:maintenance" 00:00:00 id:0x0xd000085f4 [System: No Assertions]
2017-12-13 01:02:02 +0800 Assertions PID 412(cloudphotosd) Released BackgroundTask "com.apple.cloudphotosd.darkwake.sync" 00:09:56 id:0x0xb000085e5 [System: No Assertions]
2017-12-13 01:02:02 +0800 Assertions PID 195(mDNSResponder) Released MaintenanceWake "mDNSResponder:maintenance" 00:00:00 id:0x0xd000085f4 [System: No Assertions]
2017-12-13 01:02:14 +0800 Assertions PID 63(powerd) Created InternalPreventSleep "Network wake delay proxy assertion" 00:00:00 id:0x0xd000085f8 [System: No Assertions]
2017-12-13 01:02:14 +0800 DarkWake DarkWake from Normal Sleep [CDN] due to ARPT/Network: Using BATT (Charge:73%) 30 secs
2017-12-13 01:02:14 +0800 WakeDetails DriverReason:WiFi.TCPTimeout - DriverDetails:
2017-12-13 01:02:14 +0800 HibernateStats hibmode=3 standbydelay=10800
#include <stdio.h>
#include <setjmp.h>
#include <unistd.h>
#include <stdlib.h>
sigjmp_buf jmp_env1;
sigjmp_buf jmp_env2;
void testjmp() {
printf("first run\n");