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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.IO; | |
using System.IO.MemoryMappedFiles; | |
using System.Threading.Tasks; | |
using System.Net.Sockets; | |
using System.Threading; | |
using System.Runtime.InteropServices; |
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
# Quicksort using the Y Combinator (lambda calculus) in pure Python | |
>>> Y = lambda f: lambda *args: f(Y(f))(*args) | |
>>> quicksort = Y(lambda f: | |
... lambda x: ( | |
... f([item for item in x if item < x[0]]) | |
... + [y for y in x if x[0] == y] | |
... + f([item for item in x if item > x[0]]) | |
... ) if x else []) |
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
LIGHT_ID = 123 | |
LIGHT_LEVEL = 40 | |
DOMOTICZ_URL = 'http://domoticz/json.htm?' | |
def fetch(**kwargs): | |
import json | |
import urllib | |
params = urllib.urlencode(kwargs.items()) | |
url = DOMOTICZ_URL + params |
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
perl -pi -e 's/"\{\{\s*STATIC_URL\s*\}\}\/?([^"]+)"/"{% static \x27$1\x27 %}"/g' templates/***/*.html |
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/sh | |
#/ Usage: clean-merged-branches [-f] | |
#/ Delete merged branches from the origin remote. | |
#/ | |
#/ Options: | |
#/ -f Really delete the branches. Without this branches are shown | |
#/ but nothing is deleted. | |
#/ -n Dry-run, only show what would be removed. | |
set -e |
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
[alias] | |
global-gc = !git-global-gc.sh |
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 python | |
import os | |
import sys | |
import subprocess | |
import fileinput | |
os.chdir(os.path.dirname(__file__)) | |
process = subprocess.Popen( |
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> | |
int a(){ | |
return 42; | |
} | |
double b(){ | |
return 3.141592653589793; | |
} |
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 gevent.local import local | |
from gevent.pywsgi import WSGIServer | |
from gevent import monkey | |
import socket | |
import pprint | |
import sys | |
def application(environ, start_response): | |
url = environ['PATH_INFO'] |
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
Y = lambda f: lambda *args: f(Y(f))(*args) | |
quicksort = Y(lambda f: | |
lambda x: ( | |
f([item for item in x if item < x[0]]) | |
+ [y for y in x if x[0] == y] | |
+ f([item for item in x if item > x[0]]) | |
) if x else []) |