View gist:dcaf944813e8dc4bcea5fef761c5f4aa
#!/usr/bin/env python3 | |
import argparse | |
import os | |
import subprocess | |
def mr_register(root): | |
dirs = os.listdir(root) | |
for _dir in dirs: |
View timeit.py
#!/usr/bin/env python | |
import subprocess | |
import sys | |
import time | |
def main(): | |
start_time = time.time() | |
subprocess.call(' '.join(sys.argv[1:]), shell=True) | |
delta = time.time() - start_time | |
hours = int(round(delta / 3600, 0)) |
View m4a2mp3.sh
#!/bin/bash | |
# | |
# Dump m4a to wav (first step in conversion) | |
mkdir -p output | |
for i in *.mp3 | |
do | |
mplayer -ao pcm:file="output/${i%.mp3}.wav" "$i" | |
done |
View ogg2mp3.py
#!/usr/bin/env python | |
"""Convert ogg files to mp3""" | |
from optparse import OptionParser | |
import tempfile | |
import os | |
import subprocess | |
class CommandException(Exception): | |
"""Exception that is raised if calling an external command fails""" | |
def __init__(self, command): |
View time_shift.py
#!/usr/bin/env python3 | |
import datetime | |
import argparse | |
import math | |
import os | |
import sys | |
import time | |
import subprocess | |
def parse_args(): |
View remove_non_svn_dirs.py
#!/usr/bin/env python | |
"""Remove all directories except .svn directories""" | |
import os | |
def remove_non_dot_svn_dirs(root): | |
"""Remove all directories except .svn directories under too""" | |
for dirpath, _, files in os.walk(root): | |
if dirpath.find('.svn') == -1: | |
for afile in files: | |
fullpath = os.path.join(dirpath, afile) |
View sync_music.py
#!/usr/bin/env python | |
""" | |
Synchronize music with a portable device | |
""" | |
import os | |
import subprocess | |
from easygui import msgbox, choicebox, codebox, ynbox, diropenbox | |
def sync_music(): |
View gb
#!/usr/bin/env python3 | |
import os | |
import sys | |
import subprocess | |
commandMap = { | |
# Key(command) => Value(Tuple(list of commands to run, whether to ask for confirmation)) | |
'rebase': (['git', 'svn', 'rebase'], False), | |
'diff': (['git', 'diff'], False), | |
'dcommit': (['git', 'svn', 'dcommit'], False), |
View encrpytPass.pl
#!/usr/bin/perl | |
srand (time()); | |
my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))"; | |
my $salt = sprintf ("%c%c", eval $randletter, eval $randletter); | |
my $plaintext = shift; | |
my $crypttext = crypt ($plaintext, $salt); | |
print "${crypttext}\n"; |
NewerOlder