Skip to content

Instantly share code, notes, and snippets.

View sprt's full-sized avatar

Aurélien Bombo sprt

View GitHub Profile
@sprt
sprt / dl_subs.sh
Created February 20, 2013 20:44
Automatically download movie and TV show subtitles with Transmission.
#!/bin/sh
# This will download the subtitles (if found) for the downloaded movie/TV show.
# Prerequisite: # pip install subliminal
cd $TR_TORRENT_DIR
if [ -d $TR_TORRENT_NAME ]; then
video_file=$(find $TR_TORRENT_DIR -name "*.avi" -o -name "*.mkv" \
-o -name "*.mp4" -o -name "*.rar" | head -n 1)
else
video_file="$TR_TORRENT_DIR/$TR_TORRENT_NAME"
import os.path
import sys
sys.path.insert(1, os.path.join(os.path.dirname(__file__), './lib'))
import time
import stem.descriptor
import sys
def measure_average_relays_exit(path):
start_time = time.time()
total_relays, exits, consensuses = 0, 0, 0
for consensus in stem.descriptor.parse_file(path, document_handler=stem.descriptor.DocumentHandler.DOCUMENT):
for desc in consensus.routers.values():
@sprt
sprt / app.go
Created July 14, 2016 20:56
gorilla/csrf App Engine bug
package app
import (
"fmt"
"net/http"
"github.com/gorilla/csrf"
)
func init() {
10-antialias.conf
10-hinting.conf
10-hinting-none.conf
10-scale-bitmap-fonts.conf
10-sub-pixel-rgb.conf
11-lcdfilter-default.conf
20-unhint-small-dejavu-lgc-sans.conf
20-unhint-small-dejavu-lgc-sans-mono.conf
20-unhint-small-dejavu-lgc-serif.conf
20-unhint-small-dejavu-sans.conf
digraph G {
size="7.5,10"
labeljust="l"
fontname=Helvetica;
node [fontname=Helvetica]
edge [fontname=Helvetica,fontsize=10]
subgraph cluster0 {
label="Datastore layer: Syncer goroutine";
@sprt
sprt / safe_map.go
Last active October 15, 2023 21:07
Concurrent map using channels
package main
import "fmt"
type safeMap struct {
data map[string]string
readch, writech chan chan string
}
func newSafeMap() *concurrentMap {