Skip to content

Instantly share code, notes, and snippets.

View strager's full-sized avatar

strager strager

View GitHub Profile
type State:
case state_ (Bool)
define ; (->) {
}
define raw (State, List<Char> -> State +IO):
print
define raw_string (State, List<Char> -> State +IO):
#include <iostream>
#include <vector>
namespace {
class F {
public:
template<class T>
F(
T *o,
void (*f)(T *)) :
64 bytes from 8.8.8.8: icmp_seq=161 ttl=56 time=19.274 ms
64 bytes from 8.8.8.8: icmp_seq=162 ttl=56 time=24.346 ms
64 bytes from 8.8.8.8: icmp_seq=163 ttl=56 time=19.304 ms
64 bytes from 8.8.8.8: icmp_seq=164 ttl=56 time=20.252 ms
64 bytes from 8.8.8.8: icmp_seq=165 ttl=56 time=20.240 ms
64 bytes from 8.8.8.8: icmp_seq=166 ttl=56 time=54.444 ms
64 bytes from 8.8.8.8: icmp_seq=167 ttl=56 time=19.309 ms
64 bytes from 8.8.8.8: icmp_seq=168 ttl=56 time=19.600 ms
64 bytes from 8.8.8.8: icmp_seq=169 ttl=56 time=22.545 ms
64 bytes from 8.8.8.8: icmp_seq=170 ttl=56 time=19.346 ms
$ ninja clean
$ time -p ninja b_SelfCompile
real 1.62
user 1.77
sys 0.27
real 1.63
user 1.78
sys 0.27
@strager
strager / shell.txt
Last active August 29, 2015 14:20
Valgrind bug (OS X)
$ uname -a
Darwin straddler.local 12.6.0 Darwin Kernel Version 12.6.0: Wed Dec 17 19:11:40 PST 2014; root:xnu-2050.48.15~1/RELEASE_X86_64 x86_64
$ ./test sh -c 'kill -TERM $$'
waitpid returned stats 15
$ valgrind ./test sh -c 'kill -TERM $$'
==63381== Memcheck, a memory error detector
==63381== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==63381== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
#include <stdio.h>
int
main(int argc, char **argv) {
int x = 1;
int y = 2;
int *xp = &x;
int *yp = &y;
printf("1: xp = %p; *xp = %d\n", xp, *xp);
printf("2: yp = %p; *xp = %d\n", yp, *yp);
@strager
strager / c-ctypes.md
Created February 27, 2015 06:59
C and ctypes

C and Python ctypes comparison

Totally untested.

/* C */                 # ctypes

char *x = NULL;         x = ctypes.c_char_p(None)
                        x = POINTER(ctypes.c_char)(None)

struct C { }; class C(ctypes.Structure): pass

# Based on https://hg.python.org/cpython/file/2.7/Lib/contextlib.py
class GeneratorContextManager(object):
def __init__(self, gen):
self.gen = gen
def __enter__(self):
return self.gen.next()
def __exit__(self, type, value, traceback):
#!/usr/bin/env node
// This tests checks whether fragment identifiers are
// preserved across HTTP redirects.
//
// To run:
// 1. Install Node.js.
// 2. Run this script with 'node fragredirect.js'.
// 3. Open the printed URL in your web browser.
This file has been truncated, but you can view the full file.
cgvjki8888888888888889ok iji nnnnnnnnnnnnnnm 777777777777777; mmmmmmmmmmmmmmmmmmmmmmn/≥“π…'] https://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:Big_Bang_Taeyang.jpghttps://en.wikipedia.org/wiki/File:B