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
| from gi.repository import Gtk, GLib | |
| class LedControl(Gtk.Window): | |
| """ | |
| A simple app that changes images according to the button status. | |
| """ | |
| def __init__(self): | |
| Gtk.Window.__init__(self, title="LED Control") | |
| self.set_border_width(6) |
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
| from gi.repository import Gtk | |
| class LedControl(Gtk.Window): | |
| """ | |
| A simple app that changes images according to the button status. | |
| """ | |
| def __init__(self): | |
| Gtk.Window.__init__(self, title="LED Control") | |
| self.set_border_width(6) |
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 csv | |
| import sqlite3 | |
| import sys | |
| db_con = sqlite3.connect(":memory:") | |
| db_con.text_factory = str | |
| def safe_column_name(name): | |
| """ | |
| Modifies the column name so that it only contains alphanumeric |
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
| #!/bin/sh | |
| case "$1" in | |
| start|startup) | |
| echo "starting sleep_on_dist" >> /etc/zyxel/storage/sysvol/.debian/root/ssstart | |
| /etc/zyxel/storage/sysvol/.debian/root/sleep_on_disk.sh & | |
| echo "started?" >> /etc/zyxel/storage/sysvol/.debian/root/ssstart | |
| ;; | |
| stop|shutdown) | |
| ;; | |
| *) |
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
| #!/bin/sh | |
| sleep 2400 | |
| state=`grep "sd[ab] " /proc/diskstats` | |
| same_counter=0 | |
| echo "starting" >> /haltit | |
| while [ ${same_counter} -le 60 ] ; do |
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 json | |
| import bottle | |
| @bottle.get("/text") | |
| def text(): | |
| return "Returning text" | |
| @bottle.get("/data/get") | |
| def get_data(): |
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 sys | |
| import unittest | |
| class _WritelnDecorator(object): | |
| """Used to decorate file-like objects with a handy 'writeln' method""" | |
| def __init__(self,stream): | |
| self.stream = stream | |
| def __getattr__(self, attr): | |
| if attr in ('stream', '__getstate__'): | |
| raise AttributeError(attr) |
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 time | |
| from webob import Request, Response | |
| from webob import exc | |
| def slow_generator(): | |
| yield "<html><body><h1>Starting</h1>\n" | |
| for i in range(10): | |
| yield("%s: Hello!!! Hello!!! Hello!!! Hello!!! Hello!!! Hello!!!<br>\n" % (i+1)) | |
| time.sleep(0.4) |
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
| from webob import Response | |
| class TinyApp(object): | |
| def __call__(self, environ, start_response): | |
| resp = Response("""<html><body>AHOJ</body></html>""") | |
| return resp(environ, start_response) | |
| if __name__ == '__main__': | |
| from wsgiref.simple_server import make_server |
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 copy | |
| import sqlalchemy.engine.base | |
| import sqlalchemy.dialects.mssql.base | |
| import sqlalchemy.dialects.mssql.pyodbc | |
| class SQLABaanRowProxy(sqlalchemy.engine.base.RowProxy): | |
| def __init__(self, parent, row, processors, keymap): | |
| """ | |
| For all keys starting with "t_" adds also a "t$..." key. |