View api.py
This file contains 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
class Api: | |
def __init__(self): | |
self.apis = [] | |
def register(self): | |
s = self | |
class Api: | |
def __init__(self, func): | |
self.func = func |
View coroutine.py
This file contains 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 asyncio | |
@asyncio.coroutine | |
def hello_world(): | |
while True: | |
yield from asyncio.sleep(1) | |
print('Hello World') | |
@asyncio.coroutine |
View find-not-repoed
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import argparse | |
import locale | |
import os | |
import re | |
import shlex | |
import subprocess | |
import sys |
View find-not-gitted-dir
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import locale | |
import shlex | |
import subprocess | |
def _execute(cmd): | |
p = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, |
View 20-noto-cjk.conf
This file contains 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
<?xml version="1.0"?> | |
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
<fontconfig> | |
<match target="pattern"> | |
<test name="lang"> | |
<string>zh-tw</string> | |
</test> | |
<test name="family"> | |
<string>sans-serif</string> | |
</test> |
View _etc_init.d_couchbase-sync-gateway
This file contains 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
#!/bin/sh | |
# | |
# Startup / shutdown script for the couchbase sync_gateway | |
# | |
if [ "$(id -u)" != "0" ]; then | |
echo "Must run as root" | |
exit 1 | |
fi |
View docker-enter
This file contains 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
#!/bin/bash | |
if [[ $EUID -ne 0 ]]; then | |
echo "You must be root to execute this script" 2>&1 | |
else | |
PID=$(docker inspect --format "{{ .State.Pid }}" "$1") | |
nsenter --target $PID --mount --uts --ipc --net --pid | |
fi |
View clicks_on_holding.ahk
This file contains 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
#SingleInstance force | |
Hotkey, *~$LButton, LButtonLabel | |
return | |
LButtonLabel: | |
Loop | |
{ | |
if (!GetKeyState("ScrollLock", "T") or !GetKeyState("LButton", "P")) |
View bfs.py
This file contains 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
# Ref. http://eddmann.com/posts/depth-first-search-and-breadth-first-search-in-python/ | |
def bfs(graph, queue, visited=None): | |
if visited is None: | |
visited = set() | |
if not queue: | |
return | |
start = queue.pop(0) | |
yield start |
View dfs.py
This file contains 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
# Ref. http://eddmann.com/posts/depth-first-search-and-breadth-first-search-in-python/ | |
def dfs(graph, start, visited=None): | |
if visited is None: | |
visited = set() | |
if start in visited: | |
return | |
yield start | |
visited.add(start) |