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
""" | |
Dependencies: | |
brew remove ffmpeg | |
brew install --with-libvpx --with-theora --with-libvorbis ffmpeg | |
Usage: | |
python web-video.py /path/to/videos |
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 | |
exit_if_pushing_database() { | |
if [ -f .git_push_lock ]; then | |
exit 0 | |
fi | |
} | |
dump_and_push_database() { | |
mysqldump --skip-comments --skip-dump-date -h localhost -u root db_name > db.sql |
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
# Safari no longer allows choosing default browsers from a list | |
from LaunchServices import LSSetDefaultHandlerForURLScheme | |
from LaunchServices import LSSetDefaultRoleHandlerForContentType | |
LSSetDefaultRoleHandlerForContentType("public.html", 0x00000002, "com.google.chrome.canary") | |
LSSetDefaultRoleHandlerForContentType("public.xhtml", 0x00000002, "com.google.chrome.canary") | |
LSSetDefaultRoleHandlerForContentType("public.url", 0x00000002, "com.google.chrome.canary") | |
LSSetDefaultHandlerForURLScheme("http", "com.google.chrome.canary") | |
LSSetDefaultHandlerForURLScheme("https", "com.google.chrome.canary") |
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
// ==UserScript== | |
// @name Hacker News Article Highlighter | |
// @version 0.1 | |
// @author You | |
// @include https://news.ycombinator.com/* | |
// @grant none | |
// @noframes | |
// ==/UserScript== | |
// Requires Hacker News Enhancement Suite |
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 | |
FILES=`find . -type f` | |
for F in $FILES | |
do | |
OUTPUT=`uniq -d $F 2> /dev/null` | |
LEN=${#OUTPUT} | |
if [ $LEN -ge 3 ]; then | |
echo $F | |
echo $OUTPUT |
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 | |
printf "You are about to push, have you run ...? [y]\n" | |
read -s -n1 KEY < /dev/tty | |
if [ $KEY = 'y' ]; then | |
exit 0 | |
fi |
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
from hachoir_core.cmd_line import unicodeFilename | |
from hachoir_parser import createParser | |
import sys | |
def find_atoms(filename): | |
parser = createParser(unicodeFilename(filename)) | |
atoms = [] | |
for field in parser: | |
print '%s: %s %s + %s' % (field.description, field.name, field.absolute_address, field.size) | |
if 'mdat' in field.description: |
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 SimpleHTTPServer, SocketServer | |
import subprocess, sys, os | |
class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
subprocess.call('screencapture -x -t jpg /tmp/screen.jpg', shell=True) | |
self.send_response(200) | |
self.send_header('Content-type', 'image/jpeg') | |
imgfile = open('/tmp/screen.jpg', 'rb').read() | |
self.send_header('Content-length', sys.getsizeof(imgfile)) |
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
; nasm -f macho64 mkdir.asm && ld -o mkdir mkdir.o && ./mkdir | |
%define SYSCALL_MKDIR 0x2000088 | |
%define SYSCALL_EXIT 0x2000001 | |
global start | |
section .text | |
start: | |
call mkdir |
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
var PREFIX_LENGTH = 3; | |
var itunes = Application('iTunes'), | |
selection = itunes.selection(); | |
for (var i=0; i<selection.length; i++) { | |
var song = selection[i], | |
trackNumber = parseInt(song.name().slice(0, PREFIX_LENGTH), 10), | |
name = song.name().slice(PREFIX_LENGTH); | |
if (!isNaN(trackNumber)) { |
OlderNewer