Skip to content

Instantly share code, notes, and snippets.

@engineersamuel
engineersamuel / mkv2mp4.sh
Created June 22, 2015 18:01
Encode mp4 files for DLNA streaming, works with TVs, devices, and PS4
#!/bin/bash
# ffmpeg installed via: brew install ffmpeg --enable-libx264 --enable-libfaac --enable-libass --with-faac --with-ass --with-tools
# ln -s /Applications/mkv2mp4.sh /usr/bin/mkv2mp4
MKV=$1
echo "MKV: $MKV"
MP4=`echo $MKV | sed 's/\.mkv/\.mp4/'`
echo "MP4: $MP4"
CMD="ffmpeg -y -i $MKV -vcodec copy -acodec libfaac -tune film $MP4"
echo "Executing: $CMD"
@engineersamuel
engineersamuel / thread_utils.py
Created August 27, 2013 13:40
Simple thread pool in python
class OneOffThreadPool(threading.Thread):
def __init__(self, max_concurrent_threads=10):
threading.Thread.__init__(self)
self.threads = []
self.threads_running = []
self.thread_count = 0
self.max_concurrent_threads = max_concurrent_threads
self.log = logging.getLogger(name="OneOffThreadPool")
self.log.setLevel(logging.INFO)
@engineersamuel
engineersamuel / gist:5416681
Created April 18, 2013 22:16
Example knockout expressions
<!-- variable (usually a property of the current view model -->
<div data-bind="visible: shouldShowMessage">...</div>
<!-- comparison and conditional -->
The item is <span data-bind="text: price() > 50 ? 'expensive' : 'cheap'"></span>.
<!-- function call and comparison -->
<button data-bind="enable: parseAreaCode(cellphoneNumber()) != '555'">...</button>
<!-- function expression -->
@engineersamuel
engineersamuel / ko_expressions.html
Created April 18, 2013 22:15
Example knockout expressions
<!-- variable (usually a property of the current view model -->
<div data-bind="visible: shouldShowMessage">...</div>
<!-- comparison and conditional -->
The item is <span data-bind="text: price() > 50 ? 'expensive' : 'cheap'"></span>.
<!-- function call and comparison -->
<button data-bind="enable: parseAreaCode(cellphoneNumber()) != '555'">...</button>
<!-- function expression -->
@engineersamuel
engineersamuel / gist:5416674
Created April 18, 2013 22:15
Example knockout expressions
<!-- variable (usually a property of the current view model -->
<div data-bind="visible: shouldShowMessage">...</div>
<!-- comparison and conditional -->
The item is <span data-bind="text: price() > 50 ? 'expensive' : 'cheap'"></span>.
<!-- function call and comparison -->
<button data-bind="enable: parseAreaCode(cellphoneNumber()) != '555'">...</button>
<!-- function expression -->
@engineersamuel
engineersamuel / gist:5416673
Created April 18, 2013 22:15
Example knockout expressions
<!-- variable (usually a property of the current view model -->
<div data-bind="visible: shouldShowMessage">...</div>
<!-- comparison and conditional -->
The item is <span data-bind="text: price() > 50 ? 'expensive' : 'cheap'"></span>.
<!-- function call and comparison -->
<button data-bind="enable: parseAreaCode(cellphoneNumber()) != '555'">...</button>
<!-- function expression -->
@engineersamuel
engineersamuel / gist:5416671
Created April 18, 2013 22:14
Example knockout expressions
<!-- variable (usually a property of the current view model -->
<div data-bind="visible: shouldShowMessage">...</div>
<!-- comparison and conditional -->
The item is <span data-bind="text: price() > 50 ? 'expensive' : 'cheap'"></span>.
<!-- function call and comparison -->
<button data-bind="enable: parseAreaCode(cellphoneNumber()) != '555'">...</button>
<!-- function expression -->