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
let m = Matcher::new(sequence([ | |
capture("series", many1(regex(r"^\w+$"))), | |
or([ | |
capture("season_episode", regex(r"^s\d\d?e\d\d?$")), | |
capture("season_episode", regex(r"^\d\d?x\d\d?$")), | |
sequence([ | |
capture("season", regex(r"^s\d\d?$")), | |
capture("episode", regex(r"^e\d\d?$")), | |
]), | |
sequence([ |
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 inspect | |
from collections import ChainMap | |
def f(fmt): | |
frame = inspect.currentframe() | |
try: | |
vars = ChainMap(frame.f_back.f_locals, frame.f_back.f_globals) | |
# from pprint import pprint | |
# pprint(vars) |
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 re | |
RE_SPLIT = re.compile(r""" | |
\(([^\)]+)\)[\.\s]?| # (parens) | |
\[([^\]]+)\][\.\s]?| # [square] | |
([^\.\s]+) # Sep.ara.ted | |
""", re.VERBOSE) | |
RE_YEAR = re.compile(r'(\d{4})|\((\d{4})\)') | |
TOKEN_FILTER = ('1080p', '720p') |
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
fn main() { | |
let matches = App::new("aconv") | |
.setting(AppSettings::TrailingVarArg) | |
.arg( | |
Arg::with_name("codec") | |
.short("c") | |
.required(true) | |
.takes_value(true), | |
) | |
.arg( |
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
#!/usr/bin/env python3 | |
from signal import signal, SIG_IGN, SIGTERM, SIGINT | |
import subprocess | |
import sys | |
USAGE = '''Usage: minecraftd [server jar path] [java options]*''' | |
JAVA_BIN = '/usr/bin/java' | |
JAVA_OPTS = ['-XX:+UseParNewGC', '-XX:+UseConcMarkSweepGC', | |
'-XX:+AggressiveOpts'] |
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
#!/bin/bash | |
FILE="$1" | |
TEMP=`mktemp` | |
help() { | |
echo "This programs allows you to edit an encrypted file and" | |
echo "re-encrypt it as soon as you're done editing." | |
} |
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
#!/bin/bash | |
# | |
# Installs the specified rust-stable version with the source code. | |
# | |
# The binaries are installed using the rust installer. | |
# They are located in /usr/local/bin. | |
# | |
# The source is installed in /usr/local/src/rust. | |
set -eu |
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
class Rational(object): | |
def __init__(self, num, den): | |
self.num = num | |
self.den = den | |
def __add__(self, other): | |
if isinstance(other, int): | |
num = self.num + other * self.den | |
den = self.den |
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
; create iterator from list | |
(define (iter lst) | |
(define state lst) | |
(lambda () | |
(if (null? state) | |
'() | |
(let ((v (car state))) | |
(set! state (cdr state)) | |
v)))) |
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
(define fact | |
(lambda (n) | |
(if (<= n 1) | |
1 | |
(* n (fact (- n 1))) | |
) | |
) | |
) | |
(define perms |