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 _find_neg_rect(image, pos_rects): | |
image_width, image_height = image.shape | |
rand = partial(random.randint, 1) | |
while True: | |
x = rand(image_width - 1) | |
width = rand(image_width - x) | |
y = rand(image_height - 1) | |
height = rand(image_height - y) | |
random_rect = Rect(x, y, width, height) |
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/ceval.c b/ceval.c | |
index 06ada97..27a929b 100644 | |
--- a/ceval.c | |
+++ b/ceval.c | |
@@ -4781,6 +4781,7 @@ static PyObject * | |
string_concatenate(PyObject *v, PyObject *w, | |
PyFrameObject *f, unsigned char *next_instr) | |
{ | |
+ printf("\ncalling string_concatenate\n"); | |
/* This function implements 'variable += expr' when both arguments |
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
print "\nadding string variables\n" | |
a = "zhi" | |
b = "hu" | |
c = "yao" | |
d = "xxx" | |
print a+b+c+d | |
print "\nadding string literals\n" | |
print "zhi" + "hu" + "yao" + "xxx" |
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
# coding: utf-8 | |
import math | |
def map_loop(): | |
list(map(math.sin, range(20000000))) | |
def for_loop(): | |
r = [] | |
for i in range(20000000): | |
r.append(math.sin(i)) |
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
#mkdir,cd into it | |
mkcd(){ | |
mkdir -p "$*" | |
cd "$*" | |
} |
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 time | |
from twisted.web.server import Site | |
from twisted.web.resource import Resource | |
from twisted.internet import reactor | |
from twisted.web import server | |
from twisted.internet.protocol import ProcessProtocol | |
from twisted.internet.defer import Deferred | |
from calendar import calendar |
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 <iostream> | |
using namespace std; | |
void hannoi (int n, char A, char B, char C) { | |
if (n == 1) { | |
cout << "move one from " << A << " to " << C << endl; | |
} | |
else { | |
hannoi (n-1, A, C, B); | |
cout << "move one from " << A << " to " << C << endl; |
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 python2 | |
# -*- coding: utf-8 -*- | |
import pyinotify | |
import mailbox | |
import pynotify | |
import os | |
import gtk | |
from email.header import decode_header | |
from os.path import expanduser |
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
#!/bin/bash | |
while inotifywait -e moved_to ~/.mail/{gmail,work}/inbox/new/; do | |
notify-send -i /usr/share/icons/Humanity/status/48/dialog-info.svg "You've got a new mail.'" | |
aplay -q ~/.mybashscripts/mail.wav | |
done |
NewerOlder