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 | |
| class Bar(object): | |
| def __enter__(self): | |
| pass | |
| def __exit__(self, exc, exc_type, tb): | |
| return True | |
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
| # pong.py | |
| import sys | |
| from time import time, sleep | |
| while True: | |
| print time() | |
| sys.stdout.flush() | |
| sleep(1) | |
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
| // ==UserScript== | |
| // @name Deezer equalizer stop | |
| // @description Stop Deezer player equalizer from animating, saving CPU time in the process. Very useful to save battery | |
| // @namespace http://chivil.com/ | |
| // @grant none | |
| // @match https://*.deezer.com/ | |
| // @match http://*.deezer.com/ | |
| // @include http://*.deezer.com/ | |
| // @include https://*.deezer.com/ | |
| // @version 1 |
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 RenderRST() | |
| write | |
| let tmpfile = tempname() | |
| silent execute "!rst2html \"%\" > " . tmpfile . " && x-www-browser " . tmpfile . " >/dev/null &" | |
| redraw! | |
| endfunction |
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 logging.handlers import SysLogHandler as Base | |
| class SysLogHandler(Base): | |
| def emit(self, record): | |
| if type(record.msg) is unicode: | |
| # RFC says we should prefix with BOM, but rsyslog will log the BOM | |
| record.msg = record.msg.encode('utf-8') | |
| return Base.emit(self, record) |
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
| diff --git a/src/pycountry/db.py b/src/pycountry/db.py | |
| index 38689ed..aeb8640 100644 | |
| --- a/src/pycountry/db.py | |
| +++ b/src/pycountry/db.py | |
| @@ -45,6 +45,7 @@ class Database(object): | |
| entry.attributes.get(key).value) | |
| entry_obj = self.data_class(entry, **mapped_data) | |
| self.objects.append(entry_obj) | |
| + tree.unlink() | |
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
| =head2 timeit | |
| Measure a block's execution time. | |
| Example usage: | |
| sub do_stuff() { | |
| timeit { | |
| some_method(); | |
| # and other stuff probably |
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
| // ==UserScript== | |
| // @name Readable Docker docs | |
| // @namespace http://your.homepage/ | |
| // @version 0.1 | |
| // @description Readable docs, use more than 50% screen size | |
| // @author You | |
| // @match http://docs.docker.com/* | |
| // @grant none | |
| // ==/UserScript== |
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
| #!/usr/bin/env perl | |
| use strict; use warnings; | |
| use Data::Dumper; | |
| my $less ; | |
| my $pid; | |
| my $abc = sub { | |
| $pid = open($less, "| less"); | |
| select $less; |
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
| static BitmapLayer *s_graph_layer; | |
| static GBitmap *s_cache_bitmap; | |
| static void init_bitmap(Window *window) { | |
| Layer *window_layer = window_get_root_layer(window); | |
| GRect bounds = layer_get_bounds(window_layer); | |
| s_graph_layer = bitmap_layer_create(bounds); | |
| s_cache_bitmap = gbitmap_create_blank(bounds.size, GBitmapFormat8Bit); | |
| } |
OlderNewer