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
function RenderRST() | |
write | |
let tmpfile = tempname() | |
silent execute "!rst2html \"%\" > " . tmpfile . " && x-www-browser " . tmpfile . " >/dev/null &" | |
redraw! | |
endfunction |
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
# Python 2.5 compatibility hack for property.setter, property.deleter | |
import __builtin__ | |
if not hasattr(__builtin__.property, "setter"): | |
class property(__builtin__.property): | |
__metaclass__ = type | |
def setter(self, method): | |
return property(self.fget, method, self.fdel) | |
def deleter(self, method): |
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 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 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 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 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 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
try: | |
module = __import__(name, **specs) | |
except ImportError: | |
# If tracback "length" is greater than 1, there is most | |
# probably a deeper ImportError that we don't want to | |
# mask (example: missing library used by the base import) | |
_, _, tb = sys.exc_info() | |
if len(traceback.extract_tb(tb)) > 1: | |
raise | |
# else, handle the error graciously |
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
#include <stdio.h> | |
#include <time.h> | |
#include <sys/time.h> | |
#define COUNT 800000 | |
int main() { | |
long i = 0; | |
long start, end; | |
struct timeval tstart, tend, tt; |
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
diff --git a/gdk/x11/gdkeventsource.c b/gdk/x11/gdkeventsource.c | |
index 7fff28f..a687963 100644 | |
--- a/gdk/x11/gdkeventsource.c | |
+++ b/gdk/x11/gdkeventsource.c | |
@@ -249,7 +249,7 @@ gdk_event_source_translate_event (GdkEventSource *event_source, | |
event->crossing.window != NULL) | |
{ | |
/* Handle focusing (in the case where no window manager is running */ | |
- handle_focus_change (&event->crossing); | |
+ // handle_focus_change (&event->crossing); |
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
""" | |
When `wait` is None, program does not receive signal (and cannot be stopped) | |
When anything else, signals wakes up main thread and stop as intended | |
""" | |
import os | |
import signal | |
from threading import Event | |
OlderNewer