Skip to content

Instantly share code, notes, and snippets.

@gsf
gsf / try.sh
Last active December 29, 2015 03:29
sh/bash try/catch on error message grep
#!/bin/sh
# Attempt command, printing all output to stdout, catching errors
# based on a regex, erroring out on all other errors
if output=`some-command 2>&1`
then
echo "$output"
else
if echo "$output" | grep 'regex string'
then
something --other --than bailing
@gsf
gsf / deva.md
Created December 27, 2013 04:09
deva notes

Dev script that does the following:

  1. Restarts the server on changes (a la node-dev)
  2. Bundles up browserify
  3. Restarts and re-bundles on template changes
  4. Compiles lesscss files
  5. Reload browser on any change

With etagres and streaming:

$ nab http://localhost:1041/about
REQ NUM: 100 RTN NUM: 100 QPS: 33 BODY TRAF: 517KB per second
REQ NUM: 300 RTN NUM: 290 QPS: 48 BODY TRAF: 750KB per second
$ ps aux | grep node                                                                          
gsf       8938 25.2  2.6 757788 104256 pts/8   Sl+  12:52   0:07 node server.js
$ node-tick-processor
...
   ticks parent  name
@gsf
gsf / avi2mp4.sh
Last active August 29, 2015 14:01
avi2mp4
$ for f in *.avi; do ffmpeg -i $f -strict -2 `basename $f .avi`.mp4; done
@gsf
gsf / .xinitrc
Last active August 29, 2015 14:01
fullscreen x
matchbox-window-manager -use_titlebar no &
exec xterm
$ ps aux | grep Iptab
root 2487 0.0 0.0 1216 32 ? S 17:17 0:00 /boot/.IptabLes
root 2489 0.0 0.0 50368 252 ? Sl 17:17 0:00 /boot/.IptabLes
root 2493 0.0 0.0 852 32 ? S 17:17 0:00 /boot/.IptabLex
root 4013 0.0 0.0 9040 188 ? Sl 18:04 0:00 /boot/.IptabLex
root 4209 163 0.0 50952 604 ? Sl 18:19 0:01 /boot/.IptabLes
gsf 4215 0.0 0.0 3428 772 pts/5 R+ 18:19 0:00 grep --color=auto Iptab
$ ps aux | grep Iptab
root 2487 0.0 0.0 1216 32 ? S 17:17 0:00 /boot/.IptabLes
root 2489 0.0 0.0 50368 256 ? Sl 17:17 0:00 /boot/.IptabLes
@gsf
gsf / ed.md
Last active August 29, 2015 14:03
ed is the standard text editor
@gsf
gsf / gist:51776e85bc6dc62ec32b
Created July 16, 2014 12:23
FI9821W VLC web streaming
cvlc rtsp://xxx:[email protected]:88/videoMain --sout="#transcode{vcodec=theo,acodec=vorb,ab=128,channels=2,samplerate=44100}:std{access=http{mime=video/ogg},mux=ogg,dst=:8080/vid.ogg}"
@gsf
gsf / gist:a4c20515656615347dfe
Created July 19, 2014 03:17
Git cleanslate
$ git fetch
$ git reset --hard FETCH_HEAD
@gsf
gsf / fi8910w-cvlc.md
Last active August 29, 2015 14:04
FI8910W cvlc

Audio only:

$ cvlc --network-caching=0 --no-video 'http://xxxxxx:xxxxx@xxxxxx/videostream.asf?rate=11'

With video:

$ cvlc --network-caching=0 --fullscreen 'http://xxxxxx:xxxxx@xxxxxx/videostream.asf?rate=11'