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
repeat while true | |
try | |
tell application "System Events" | |
set frontApp to name of first application process whose frontmost is true | |
end tell | |
if (frontApp is equal to "Dummy-Finder") then | |
tell application "/System/Library/CoreServices/Finder.app" to activate | |
end if | |
on error | |
delay 1 |
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
tell application "Photo Booth" to activate | |
tell application "System Events" | |
click (menu item 1 of menu 1 of menu bar item 6 of menu bar 1 of (first application process whose frontmost is true)) | |
end tell |
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
on run argv | |
if (count of argv) is 2 then | |
set n to item 1 of argv | |
else | |
set n to 3 | |
end if | |
if "stop" is in argv then | |
set n to 2 | |
end if | |
tell application "System Events" |
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/sh | |
gtimeout --foreground $1 youtube-dl --no-part livestre.am/huy; killall avconv |
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/zsh | |
# Flash a message in Morse code with an USB light | |
uhubctl -a 1; sleep 4.0 | |
UHCOPTS=$(uhubctl | awk '{ text=text"\n"$0; if ($0~/hub/) text=$0; if (text~/power$/) { print text; text="" } }' \ | |
| awk -F',| |:' -v ORS=" " '{ print $5 }' | awk '{ print "-p "$2" -l "$1 }') | |
uhubctl -a 0 ${=UHCOPTS} | |
alias dit="uhubctl -a 1 $UHCOPTS; sleep 0.1; uhubctl -a 0 $UHCOPTS" | |
alias dah="uhubctl -a 1 $UHCOPTS; sleep 0.6; uhubctl -a 0 $UHCOPTS" |
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/zsh | |
A=arduino; B=build; HW=hardware; T=tools; | |
AA=${(C)A}.app; INOD=${1%/*}; rm -frv $INOD/$B; mkdir $INOD/$B | |
cd $(stat -f %Y $(locate $AA | grep -m1 $AA\$))/Contents/Java/ | |
FAOD=$1$OLDPWD/; INOF=${FAOD:#/*}$1; BPATH=${FAOD:#/*}$INOD/$B | |
$A-${B}er -$HW=$HW -$T=$T-${B}er -$T=$HW/$T/avr -libraries=libraries -$B-path=${BPATH/$1} -fqbn=${A}:avr:uno -verbose ${${INOF/$1}:-$1} | |
avrdude -C$HW/$T/avr/etc/avrdude.conf -v -patmega328p -c$A -P$(ls /dev/cu.usbmodem*) -b115200 -D -Uflash:w:$(ls ${BPATH/$1}/*ino.hex):i |
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/sh | |
gtimeout $1 curl nr5.newradio.it:8701/stream > radioblu.m4a |
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/sh | |
TS="$1";BN="${TS%.*}";ED="$BN-edit";LOG="${TS%/*}/ffmpeg.log";VF="blackdetect" | |
ffmpeg -i $TS -vf $VF=d=0.04 -f rawvideo -y /dev/null 2>&1 | tr \\r \\n > $LOG | |
eval $(awk -F ':| ' 'BEGIN {be=0.00} /black/ {print "ffmpeg -i $TS -ss "be" -to "$5" $BN-"NR".ts;"; be=$7}' $LOG) | |
for FILE in $BN-*;do ffprobe $FILE 2>&1 | grep -q " 00:0" && rm -fv $FILE;done | |
cat $BN-* > $ED.ts; ffmpeg -i $ED.ts $ED.mp4; rm -fv $BN-*.ts $LOG |
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
/*jslint node: true, nomen: true*/ | |
"use strict"; | |
var path = require('path'); | |
var _ = require('underscore'); | |
var Faced = require('faced'); | |
var faced = new Faced(); | |
function worker(faces, image, file) { |
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/zsh | |
# Print total input media duration. | |
MS=$(printf "%0.f\n" "0$(mediainfo --Full --Output='General;+%Duration%' $~@)") | |
echo "$[$MS/3600000]:$[$[$MS%3600000]/60000]:$[$[$MS%60000]/1000],$[$MS%1000]" |