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
#include <utility> | |
#include <iostream> | |
template <typename Retval, typename T> | |
auto make_ref(Retval T::*prop) { | |
return [=](T &obj) -> Retval& { return obj.*prop; }; | |
} | |
template <typename Retval, typename T, typename... Args> | |
auto make_ref(Retval T::*prop, Args... args) { |
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 | |
find-open-files() { | |
find /proc/$1/fd/ -maxdepth 1 -lname '/*' -not -lname '/dev/*' -printf "%f\n" | |
} | |
format-file() { | |
readlink -f /proc/$1/fd/$2 | |
} |
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 | |
N=0 | |
echo $N | |
tail -qfn+0 $@ | while read line; do | |
N=$((N+1)) | |
echo -e "\e[1A\e[K${N}" | |
done |
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 | |
import site | |
site.addsitedir('env/src/tmxutil') | |
import sys | |
import re | |
from datetime import datetime | |
from tmxutil import make_reader, TMXWriter | |
from collections import defaultdict | |
from logging import getLogger, ERROR |
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
items = [ | |
'a.5.b.1', | |
'a.1.b.4', | |
'a.1.b.14', | |
] | |
def natcast(item): | |
if item.isdigit(): | |
return int(item) | |
else: |
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
var PDOKGeocoder = L.Class.extend({ | |
options: { | |
suggestUrl: 'https://geodata.nationaalgeoregister.nl/locatieserver/v3/suggest', | |
lookupUrl: 'https://geodata.nationaalgeoregister.nl/locatieserver/v3/lookup', | |
geocodingQueryParams: { | |
wt: 'json' | |
} | |
}, | |
initialize: function(options) { |
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
begin remote | |
name LED-SF-00297 | |
flags SPACE_ENC|CONST_LENGTH | |
eps 20 | |
aeps 200 | |
bits 32 | |
header 9000 4500 | |
one 560 1690 | |
zero 560 560 |
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 array_path($array, $path, $default_value = null) | |
{ | |
// Construct the path | |
if (!preg_match('/^(?P<head>\w+)(?P<rest>(\[\w+\]|->\w+)*)$/', $path, $match)) | |
throw new InvalidArgumentException("The path '$path' is malformed"); | |
$steps = [['index' => $match['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
from pprint import pprint | |
class l(object): | |
__slots__ = ('word',) | |
def __init__(self, word): | |
self.word = word | |
def __repr__(self): | |
return 'l({})'.format(self.word) |
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
ffmpeg -i "$INPUT" -ac 1 -ab 128000 -acodec aac -f mp4 "$OUTPUT" |