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
# vim: fileencoding=utf-8 | |
import asyncio | |
import functools | |
class ConcurrentManager(object): | |
def __init__(self, concurrency): | |
self._sem = asyncio.locks.Semaphore(concurrency) | |
def wrap(self, func): |
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
--- gnome-settings-daemon-3.16.0/plugins/power/gsd-power-manager.c.orig 2015-04-06 23:29:49.524370265 +0900 | |
+++ gnome-settings-daemon-3.16.0/plugins/power/gsd-power-manager.c 2015-04-06 23:30:50.168580365 +0900 | |
@@ -1009,10 +1009,7 @@ | |
g_error_free (error); | |
} | |
- if (manager->priv->is_tablet) | |
- action_suspend (manager); | |
- else | |
- screen_devices_disable (manager); |
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 sqlite3 | |
def lock(filename, timeout=0): | |
db = sqlite3.connect(filename, | |
timeout=timeout, | |
isolation_level='EXCLUSIVE') | |
db.execute('CREATE TABLE IF NOT EXISTS lock (id INT PRIMARY KEY)') | |
db.execute("INSERT INTO lock VALUES (1)") |
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
# vim: fileencoding=utf-8 | |
import sys | |
from PyQt4 import QtGui | |
app = QtGui.QApplication(sys.argv) | |
# 代入して呼ぶと動く (ウィンドウが出る) | |
win = QtGui.QMainWindow() |
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 Base(object): | |
def __init__(self): | |
print('original') | |
class Klass(Base): | |
pass | |
Klass() |
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
# vim: fileencoding=utf-8 | |
from __future__ import print_function | |
import sys | |
from twisted.internet import defer | |
from twisted.internet.protocol import Protocol | |
from twisted.internet.stdio import StandardIO | |
from docker import dockerAPI |
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
from tornado.platform.asyncio import AsyncIOMainLoop | |
AsyncIOMainLoop().install() | |
import tornado.platform.twisted | |
tornado.platform.twisted.install() | |
import asyncio | |
from twisted.internet import reactor |
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
def ClosureObject(x): | |
self = dict() | |
self['x'] = x | |
def getX(): | |
return self['x'] | |
self['getX'] = getX | |
def setX(x): |
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/python | |
# vim: fileencoding=utf-8 | |
u'''Translate YAML written text to graphviz dot language | |
Input YAML text like below: | |
--- | |
employee: | |
- name | |
- age |
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
--- VCS_INFO_get_data_hg.orig 2013-11-07 10:37:51.044470438 +0900 | |
+++ VCS_INFO_get_data_hg 2013-11-07 10:38:07.448264214 +0900 | |
@@ -6,7 +6,7 @@ | |
setopt localoptions extendedglob NO_shwordsplit | |
local hgbase bmfile branchfile rebasefile dirstatefile mqseriesfile \ | |
- mqstatusfile mqguardsfile patchdir mergedir \ | |
+ mqstatusfile mqguardsfile patchq patchdir mergedir \ | |
r_csetid r_lrev r_branch i_bmhash i_bmname \ | |
revformat branchformat hgactionstring hgchanges \ |