Skip to content

Instantly share code, notes, and snippets.

@kamyar
kamyar / gitio
Created October 7, 2015 10:37 — forked from defunkt/gitio
Turn a github.com URL into a git.io URL.
#!/usr/bin/env ruby
# Usage: gitio URL [CODE]
#
# Turns a github.com URL
# into a git.io URL
#
# Copies the git.io URL to your clipboard.
url = ARGV[0]
code = ARGV[1]
@kamyar
kamyar / VideoCMD.txt
Created October 7, 2015 10:34
Viero - Useful Commands
Trim Video:
avconv -i inp.avi -vcodec copy -acodec copy -ss 01:00:00 -t 0:30:00 out.avi
Join Videos:
vlc *.mp4 vlc://quit --sout "#gather:std{access=file,mux=mp4,dst=all.mp4}" --sout-keep
from docopt import docopt
import sys
class command(object):
registry = {}
short_docs = []
def __init__(self, doc = None):
self.short_docs.append(doc)
def __call__(self, fn):
@kamyar
kamyar / example.html
Last active June 13, 2018 17:09 — forked from schmuli/example.html
A simple AngularJS service for handling the 'onbeforeunload' event
<!DOCTYPE html>
<html data-ng-app="TestApp">
<head>
<script src="http://code.angularjs.org/1.2.9/angular.js"></script>
<script>
angular.module('TestApp', [])
.factory('beforeUnload', function ($rootScope, $window) {
// Events are broadcast outside the Scope Lifecycle
@kamyar
kamyar / README.md
Last active January 30, 2017 07:14 — forked from hofmannsven/README.md
@kamyar
kamyar / ceng242-hw6-IO
Created June 11, 2013 13:12
sorted output for ntiles(1/7,8,4,P).
P = [1/1, 3/1, 5/1, 7/1] ;
P = [1/1, 3/1, 5/1, 7/2] ;
P = [1/1, 3/1, 5/1, 8/1] ;
P = [1/1, 3/1, 5/1, 8/2] ;
P = [1/1, 3/1, 5/2, 7/1] ;
P = [1/1, 3/1, 5/2, 7/2] ;
P = [1/1, 3/1, 5/2, 8/1] ;
P = [1/1, 3/1, 5/2, 8/2] ;
P = [1/1, 3/1, 6/1, 8/1] ;
P = [1/1, 3/1, 6/1, 8/2] ;
PLNM="111001011"
data="11011010" + "10101010" + "11101110" + "00000000"
# ^board ^msg1 ^msg0 ^result
data_len=len(data)
PLNM_len=len(PLNM)
for i in range(0,data_len-PLNM_len+1):
print "Step %5s: %s"%(i,data)
if data[i] == "1":
for k in range(0,PLNM_len):
if data[k+i] == PLNM[k]: