This file contains hidden or 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
package main | |
import ( | |
"flag" | |
"fmt" | |
"image" | |
_ "image/gif" | |
_ "image/jpeg" | |
_ "image/png" | |
"io" |
This file contains hidden or 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 netaddr | |
import lglass.bird | |
import lglass.route | |
import lglass.database.file | |
with open("routes.bird") as fh: | |
routes = lglass.route.RoutingTable(lglass.bird.parse_routes(fh)) |
This file contains hidden or 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 python3 | |
# coding: utf-8 | |
import hashlib | |
import argparse | |
import lglass.database.file | |
import lglass.rpsl | |
def spec_id(spec): |
This file contains hidden or 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
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE < 199309L | |
#error Expected _POSIX_C_SOURCE >= 199309L | |
#endif | |
#ifndef _POSIX_C_SOURCE | |
#define _POSIX_C_SOURCE 199309L | |
#endif | |
#include <time.h> | |
#include <stdio.h> |
This file contains hidden or 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 | |
BIRD4="sudo /opt/bird/sbin/birdc" | |
BIRD6="sudo /opt/bird/sbin/birdc6" | |
BIRD=$BIRD4 | |
case $SSH_ORIGINAL_COMMAND in | |
bird*4|ip*4) | |
BIRD=$BIRD4 |
This file contains hidden or 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
// -fstrict-aliasing -Wall -Wextra -Werror -pedantic -std=c99 | |
#include <string.h> | |
#include <stdio.h> | |
#define ARRAY_COPY(dst, src, len) {\ | |
struct {\ | |
struct {\ | |
char __[len];\ | |
} *__s, *__d;\ |
This file contains hidden or 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
/* gcc -o intlen intlen.c */ | |
#include <stdio.h> | |
#define TYPE_INFO(type) #type, (sizeof(type) * 8), sizeof(type) | |
#define TYPE_FORMAT "%s\t%u\t%u\n" | |
int main(void) | |
{ | |
puts("type\tbits\tbytes"); |
This file contains hidden or 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
<?php | |
function get_head_commit($dir = "./") { | |
$head = explode(": ", file_get_contents($dir . "/HEAD")); | |
assert($head[0] == "ref"); | |
$head = $head[1]; | |
$head = file_get_contents($dir . "/" . $head); | |
return $head; | |
} | |
?> |
This file contains hidden or 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 is O(scary) | |
def match_string(hay, nee): | |
if not nee: | |
return 0 | |
index = {} | |
for offset, c in zip(range(0, len(hay)), hay): | |
if c not in index: | |
index[c] = [] | |
index[c].append(offset) | |
indices = [] |
This file contains hidden or 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 window(iterable, size=2): | |
i = iter(iterable) | |
win = [] | |
for e in range(0, size): | |
win.append(next(i)) | |
yield win | |
for e in i: | |
win = win[1:] + [e] | |
yield win |