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
/* | |
Simple HTTP proxy in Rust. Hard coded to proxy rust-lang.org. | |
*/ | |
extern crate hyper; | |
use std::io::Read; | |
use hyper::Client; | |
use hyper::header::Connection; |
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
# This file was my first attempt at using libraw with ctypes. For a more | |
# complete project check out https://github.com/photoshell/rawkit | |
# Usage: python raw_develop.py some/raw/file.cr2 some/destination/file.ppm | |
from ctypes import * | |
import sys | |
libraw = cdll.LoadLibrary('libraw.so.10') |
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
extern crate iron; | |
use iron::prelude::*; | |
macro_rules! response { | |
( $( $x:expr ),* ) => { | |
{ | |
Ok(Response::with(($( | |
$x, | |
)*))) |
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
# Generates a new unique filename if the provided filename already exists, | |
# otherwise just return the provided filename. | |
# Usage: python unique.py name/of/file | |
import os | |
import sys | |
def increment(filename): | |
last = filename.split()[-1] |
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
456D7BC4 6B19C7A7 F2136C0C 24B43C27 85AB4C8D | |
EB67EE95 3DF5AEDA AB4D3C81 A784D0E7 98AF49A0 | |
940AAD6D 130F674D 7C9C99B9 CA6C4CD7 35DC21DA | |
0B1FCE0E 61A29864 737DF8BD 47413821 94CFF83D | |
119A3473 7C31A5B9 E20A6024 5DA365D8 F360071A |
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
this.cache = (function() { | |
// Inserts a node into a circular double linked list | |
var insert = function(head, node) { | |
return (((node.prev = head.prev).next = node).next = head).prev = node; | |
}; | |
// Removes a node from a circular double linked list | |
var remove = function(node) { | |
return ((node.prev.next = node.next).prev = node.prev) && node; | |
}; |
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
# Samples a color from the screen and prints the hex value to the terminal. | |
# Usage: `python color_picker.py` and then click somewhere to sample. | |
from gi import require_version | |
require_version('Gdk', '3.0') | |
require_version('Gtk', '3.0') | |
from gi.repository import Gdk | |
from gi.repository import Gtk |
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
\documentclass[margin, 11pt]{res} | |
\usepackage{enumitem} | |
\usepackage{setspace} | |
\setlength{\oddsidemargin}{-.125in} | |
\setlength{\topmargin}{-.125in} | |
\setlength{\textheight}{10in} | |
\begin{document} |
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
# Inverted version of the first example from https://wiki.gnome.org/Projects/PyGObject/Threading | |
# GTK runs in the spawned thread instead of the other way around. | |
import threading | |
import time | |
from gi.repository import GLib, Gtk, GObject | |
# yay hacks |
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 mock | |
print(mock.MagickMock() == mock.ANY) | |
print(mock.ANY == mock.MagickMock()) |
NewerOlder