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
/* g++ -o exrect `pkg-config --libs opencv` exrect.cpp */ | |
#include <iostream> | |
#include "opencv2/opencv.hpp" | |
using namespace std; | |
using namespace cv; | |
int main(int argc, char *argv[]) |
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
/* g++ -o keyp `pkg-config --libs opencv` keyp.cpp */ | |
#include <iostream> | |
#include <vector> | |
#include "opencv2/opencv.hpp" | |
using namespace std; | |
using namespace cv; |
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
local ffi = require "ffi" | |
ffi.cdef[[ | |
double hypot(double x, double y); | |
double copysign(double x, double y); | |
]] | |
local mathx = ffi.C | |
function round(x) | |
local i, f = math.modf(x + mathx.copysign(0.5, x)) | |
return 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
import sys | |
import os | |
import linecache | |
class Profiler: | |
def __init__(self, instrument): | |
self.instrument = instrument | |
def run(self, func, *args, **kwargs): |
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 subprocess | |
call = "ctags -no - *.c" | |
tags = subprocess.check_output(call, shell=True) | |
funcs = [] | |
for entry in tags.split('\n'): | |
tokens = entry.split('\t') | |
if tokens[-1].strip() == "f": | |
func, source, line, symboltype = tokens |
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/python | |
import urllib2 | |
import json | |
import time | |
import sys | |
baseurl = "http://openexchangerates.org/api/latest.json" | |
key = "{{Your Open Exchange Rates App ID here!}}" | |
url = baseurl + "?app_id=" + key |
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 <stdlib.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include <ctype.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#define write16(fd, n) write((fd), (uint8_t []) {(n) >> 8, (n) & 0xFF}, 2) | |
#define write32(fd, n) do { \ |
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 codecs | |
import collections | |
def join(t1, t2, pivots=None, keys=None): | |
keys1 = t1[0]._fields | |
keys2 = t2[0]._fields | |
if pivots is None: | |
pivots = list(set(keys1) & set(keys2)) | |
if keys is None: | |
keys = list(set(keys1) | set(keys2)) |
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
# To use this script, save the image from the page below as '7sled.png'. | |
# http://imgur.com/C2OLhYj | |
# The script should create a file 'test_bmp_font.bmp' that looks like this: | |
# http://imgur.com/WFJNRTT | |
import atexit | |
import sdl2 | |
import sdl2.ext |
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 | |
if [ $# -lt 1 ] || [ $# -gt 3 ] | |
then | |
printf 'usage:\n %s <file> [offset [limit|(+|-)length]]\n' `basename $0` | |
exit 1 | |
fi | |
IN="$1" | |
START=0 |
OlderNewer