Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Michele Venturi dardo82

🏠
Working from home
View GitHub Profile
@dardo82
dardo82 / mk-dyn-uti-conv.sh
Created Aug 24, 2014
Dynamic UTI encoder and decoder
View mk-dyn-uti-conv.sh
DU="dyn-uti"; DUC="$DU-conv"; ZB="zbase32"; ZBP="$ZB.py"; mkdir -p $DUC; cd $DUC; pip install $ZB; cp `pip show $ZB | grep / | cut -d: -f2`/$ZB/$ZBP .
sed -i '' '/^mnet32/s/^/uti_alphabet = "abcdefghkmnpqrstuvwxyz0123456789" # Mac OSX Dynamic UTI\'$'\n/' $ZBP; sed -i '' '/^chars/s/mnet32/uti/' $ZBP
DUE="$DU-enc.sh"; DUD="$DU-dec.sh"; echo "python -c \"import $ZB; print $ZB.b2a('\$1')\"" > $DUE; echo "python -c \"import $ZB; print $ZB.a2b('\$1')\"" > $DUD
chmod a+x $DUE $DUD; echo "Usage:\\ncd $DUC\\n./$DUE '?0=7:3=text/X-frob:1=frob'\\n./$DUD 'h62d4r34gq81k3p2su1zuppgsm10esvvhzxhe55c'"
@dardo82
dardo82 / it.dardo82.TellTheTime.plist
Last active Aug 29, 2015
Italian speaking clock
View it.dardo82.TellTheTime.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnableGlobbing</key>
<true/>
<key>Label</key>
<string>it.dardo82.TellTheTime</string>
<key>ProgramArguments</key>
<array>
@dardo82
dardo82 / go-to-mp4-url.sh
Last active Aug 29, 2015
MP4 URL of online videos
View go-to-mp4-url.sh
#!/bin/bash
case $1 in
*rai*)
FS="\\\'"; PAT="web_[0-9]\.mp4";;
*nowvideo*)
FS="\\\""; PAT="mp4"; REGEXP="video\/"; SUB="mobile/index.php?id=";;
*firedrive*)
FS="\\\""; PAT="mobile="; REGEXP="www"; SUB="m";;
*fastvideo*)
@dardo82
dardo82 / aaa.sh
Last active Apr 2, 2016
Astro Animal Audio
View aaa.sh
#!/bin/zsh
events=(sunrise sunset moon_transit)
WA_URL="http://api.wolframalpha.com/v2/query?format=plaintext&appid=UYJL7G-54E6J64EK2&input="
for event in $events; do
eval $event=$(curl -s "$WA_URL${event/_/+}" | gawk -v RS='</?plaintext>' 'NR==4 {print $1$2}')
eval echo play '"/Library/Application\ Support/Astro\ Animal\ Audio/"'$event.aiff \| at \$$event
done
@dardo82
dardo82 / parole.awk
Created Oct 11, 2014
First N italian words
View parole.awk
#! /usr/bin/env gawk -f
BEGIN {
RS="==="
}
NR<8 && /\[\[|\]\]/ {
gsub (/\[|\]/,"")
for (i=1; i<=n; i++) \
m[i,NR]=$i
}
@dardo82
dardo82 / fastvideo-mp4.sh
Last active Oct 21, 2015
FastVideo MP4 URL
View fastvideo-mp4.sh
#!/bin/zsh
GC_CLI="${${$(ps aux|grep -E -m1 -o 'Chrom(e( Canary)?|ium)\.app')%.*}:l}-cli"
$GC_CLI source -t $($GC_CLI list tabs|awk -F'\\[|\\]' /Fastvideo/'{print $2}')|\
awk -F'<|>' /mp4/'{sub(/eval/,"print",$0);print $3$4$5}'|rhino -f - 2>&1|awk -F'"' /mp4/'{print $6}'
@dardo82
dardo82 / MyFreeCams.sh
Last active Aug 13, 2016
MyFreeCams on AppleTV
View MyFreeCams.sh
#!/bin/sh
ROOMID="$(curl -s $(echo "$1" | awk '{sub(/www/,"profiles"); sub(/#/,""); print $0}') | awk -F/ '/\/[0-9]{7,8}\//{print $6; exit}')"
if [ ${#ROOMID} -eq 7 ]; then
PREFIX="10"; else
PREFIX="1"
fi
MFCURL="http://video .myfreecams.com:1935/NxServer/mfc_$PREFIX$ROOMID.f4v_aac/playlist.m3u8"
for n in $(seq 340 492); do
View Kodi--Enlarge---Fonts-for-AppleTv--Interface--Completely--Automatically.sh
#!/bin/sh
cd Library/Application\ Support/Kodi/addons/skin.sio2/1080i
cp Font.xml Font.xml.orig
awk -F'<|>' '{\
if($0~/<fontset id="Default">/)f=1;\
if(f==1)fs=fs"\n"$0;\
if($0~/<\/fontset>/)f=0;\
gsub(/>[0-9]+</,"\\>"$3*2"\\<",fs);\
if($0!~/<\/fonts>/)print $0;\
@dardo82
dardo82 / rm-ads-rec-tv.sh
Last active Aug 29, 2015
Remove Ads from TV
View rm-ads-rec-tv.sh
MF=$HOME/Movies;FM="ffmpeg";BF="blackframe";C3="Comici37"
./$FM -i $MF/$C3/$C3.ts -vf $BF -f null - 2>$C3.txt
pt=0;n=0;for t in `grep $BF $C3.txt|cut -d\ -f8|cut -d: -f2|cut -d. -f1|uniq`
do d=$[$t-$pt];if [ $d -gt 180 ];then O=$O"-ss $pt -t $d $MF/$C3/$C3-$n.mp4 "
n=$[$n+1];fi;pt=$t;done;./$FM -i $MF/$C3/$C3.ts $O;rm $C3.txt
@dardo82
dardo82 / rai-air-replayer.sh
Last active Sep 24, 2015
RAIreplay on AppleTV
View rai-air-replayer.sh
#!/bin/sh
echo "Che trasmissione vuoi vedere?"
read SHOW
echo "Su che canale?"
read CHAN