Skip to content

Instantly share code, notes, and snippets.

@jbking
jbking / subprocess-example.py
Created March 9, 2011 13:47
wait external process started before testing and kill before exit in teardown in testing cycle.
import os
import time
import socket
import xmlrpclib
import subprocess
here = os.path.dirname(os.path.abspath(__file__))
target = os.path.join(here, 'server.py')
gateway = None
diff -r 66c307b0b7f9 docs/source/erlang_in_practice.rst
--- a/docs/source/erlang_in_practice.rst Tue Dec 01 01:41:06 2009 +0900
+++ b/docs/source/erlang_in_practice.rst Wed May 12 14:54:24 2010 +0900
@@ -22,7 +22,7 @@
- loop から始まるプロセスを常時起動しているコードを書く
- loop を拡張していき、なんかしらのアプリを書いてみる
-上記3つについて具体的にどのような内容で勉強をす滑るべきなのかを解説していきます。
+上記3つについて具体的にどのような内容で勉強をするべきなのかを解説していきます。
diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j
index fc82ea3..86b1f58 100644
--- a/AppKit/CPWindow/CPWindow.j
+++ b/AppKit/CPWindow/CPWindow.j
@@ -176,6 +176,7 @@ CPWindowWillCloseNotification = @"CPWindowWillCloseNotification";
CPWindowDidBecomeMainNotification = @"CPWindowDidBecomeMainNotification";
CPWindowDidResignMainNotification = @"CPWindowDidResignMainNotification";
CPWindowDidMoveNotification = @"CPWindowDidMoveNotification";
+CPWindowDidResizeNotification = @"CPWindowDidResizeNotification";
CPWindowWillBeginSheetNotification = @"CPWindowWillBeginSheetNotification";
@jbking
jbking / using-azerty?.el
Created June 9, 2009 04:57 — forked from anonymous/gist:126269
the function how to get a keyboard layout
(defun using-azerty? ()
(condition-case nil
(let ((buffer (get-buffer-create "*using-azerty?*"))
return)
(set-buffer buffer)
(erase-buffer)
(call-process-shell-command "setxkbmap" nil buffer nil "-print")
(goto-char (point-min))
(setq return (search-forward "azerty" nil t))
(kill-buffer buffer)
@jbking
jbking / nginx.conf
Created May 10, 2015 11:39
proxy to same location but via different path with logging each other.
error_log logs/error.log error;
http {
access_log logs/access.log combined;
server {
listen 8081;
root /tmp/;
}
server {
listen 8080;
@jbking
jbking / inheritance.py
Last active August 29, 2015 14:10
Check Python Inheritance Behavior
$ python inheritance.py
At SuperClass.echo: SuperClass
----------
Before calling super at AClass.echo: AClass
At SuperClass.echo: AClass
After calling super at AClass.echo: AClass
----------
Before calling super at BClass.echo: BClass
At SuperClass.echo: BClass
After calling super at BClass.echo: BClass
import shutil
import os
import sys
import pickle
from dropbox.rest import ErrorResponse
STATE_FILE = '.dropbox_state'
REMOTE_ROOT_PATH = '/Apps/my-pythonista-app' # sync root in dropbox where code is
@jbking
jbking / Counter.py
Last active August 29, 2015 14:04
Counter
# coding: utf-8
import ui
v = ui.load_view('Untitled')
i = 0
lbl = v['label1']
def btn_action(sender):
global i