Skip to content

Instantly share code, notes, and snippets.

@TJSomething
TJSomething / sudoku.html
Last active August 29, 2015 13:57
Handwritten asm.js Sudoku Solver
<html>
<head>
<title>
Handwritten asm.js Sudoku Solver
</title>
</head>
<body>
<textarea id="grid-entry" cols="18" rows="9">5 3 - - 7 - - - -
6 - - 1 9 5 - - -
- 9 8 - - - - 6 -
@TJSomething
TJSomething / reencode-hi10p.sh
Created December 27, 2013 10:18
Transcode Hi10p files in a directory to 8-bit
#!/bin/bash
set -e
find "$1" -iname '*.mkv' -o -iname '*.mp4' | while read line; do
if avprobe "$line" -v quiet -show_streams 2>/dev/null | grep -q "pix_fmt=yuv420p10le"; then
echo -n "Transcoding $line ... "
x264 --preset veryfast --tune animation --crf 18 -o "$line.8bit" "$line"
echo rm "$line"
echo mv "$line.8bit" "$line"
@TJSomething
TJSomething / hn_lang_rank.py
Last active December 25, 2015 05:29
Uses Wilson confidence intervals to rank the results of this Hacker News language poll (https://news.ycombinator.com/item?id=6527104).
#!/usr/bin/python3
import re
from math import sqrt
import urllib.request
# Thanks to http://possiblywrong.wordpress.com/2011/06/05/reddits-comment-ranking-algorithm/
def confidence_fixed(ups, downs):
if ups == 0:
return -downs
n = ups + downs