This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
我终于有了勇气来谈谈我在文学上的师承。小时候,有一次我哥哥给我念过查良铮先生译的《青铜骑士》: | |
我爱你,彼得建造的大城 | |
我爱你庄严、匀整的面容 | |
涅瓦河的流水多么庄严 | |
大理石平铺在它的两岸…… |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
import Queue as queue | |
def singleton(cls): | |
instances = {} | |
def _singleton(*args, **kw): | |
if cls not in instances: | |
instances[cls] = cls(*args, **kw) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import Cocoa | |
import CoreFoundation | |
//import PlaygroundSupport | |
//PlaygroundPage.current.needsIndefiniteExecution = true | |
class CurrencyConverter { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function callAlfred() | |
if (hs.window.focusedWindow():application():name() ~= "Alfred 3") then | |
hs.osascript.applescript('tell application "Alfred 3" to search') | |
hs.keycodes.setLayout("ABC") | |
else | |
hs.eventtap.keyStroke({}, "escape") | |
end | |
end | |
hs.hotkey.bind({"alt"}, "space", callAlfred) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emacs_env = hs.hotkey.modal.new('', nil) | |
emacs_env:bind('alt', 'F', function() hs.eventtap.keyStroke({"alt"}, "right") end) | |
emacs_env:bind('alt', 'B', function() hs.eventtap.keyStroke({"alt"}, "left") end) | |
emacs_env:bind('alt', 'D', function() hs.eventtap.keyStroke({"alt"}, "forwarddelete") end) | |
emacs_env:bind('ctrl', 'N', function() hs.eventtap.keyStroke({}, 'down') end) | |
emacs_env:bind('ctrl', 'P', function() hs.eventtap.keyStroke({}, 'up') end) | |
emacs_env:bind('ctrl', 'U', function () hs.eventtap.keyStroke({'cmd'}, 'delete') end) | |
emacs_env:bind('ctrl', 'W', function () hs.eventtap.keyStroke({'alt'}, 'delete') end) | |
emacs_env:enter() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding=utf8 | |
from __future__ import print_function | |
import multiprocessing | |
def heat(): | |
print("I'm so hot") | |
while True: | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lines = """I am happy to join with you today in what will go down in history as the greatest demonstration for freedom in the history of our nation. | |
Five score years ago, a great American, in whose symbolic shadow we stand today, signed the Emancipation Proclamation. This momentous decree came as a great beacon light of hope to millions of Negro slaves who had been seared in the flames of withering injustice. It came as a joyous daybreak to end the long night of their captivity.""" | |
def wrap_line(tokens): | |
if len(' '.join(tokens)) <= 80: | |
return ' '.join(tokens) | |
for i in range(len(tokens)): | |
if len(' '.join(tokens[:i+1])) > 80: | |
return ' '.join(tokens[:i]) + '\n' + wrap_line(tokens[i:]) |
NewerOlder