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 | |
cd "${0%/*}/../conf/url/" | |
for user in $(cat ../users.list); do | |
TWEETS=$(t search timeline -d -l user "#Periscope:" | grep -v " RT @") | |
OLDIFS=$IFS; IFS=$'\n' | |
for tweet in $(echo $TWEETS); do | |
DATE=$(echo $tweet | cut -d\ -f2-6) | |
OLD_LC_ALL=$LC_ALL; export LC_ALL="POSIX" | |
SEC=$(($(date +%s) - $(date -j -f ' %b %e %H:%M ' "$DATE" +%s))) |
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 | |
join -1 2 -2 2 <(echo ${${1//,/\\n}//({|})/}) <(echo ${${2//,/\\n}//({|})/})|gsed 's/^ /(/;s/ /,/;s/$/)/;s/\n/,/'|gsed -z 's/\n/,/g;s/^/{/;s/,$/}\n/' |
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 | |
# Use an USB light to let FW webcam see | |
PATH=$PATH:/usr/local/bin | |
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 }') | |
if [ -n "$UHCOPTS" ]; then | |
uhubctl -a 0 ${=UHCOPTS} | |
DEVNAME="iSight"; DEVGUID=$(system_profiler SPCameraDataType | awk -v dev="$DEVNAME:" -F':|x|-' '{ if ($0~dev) n=NR; if (NR==n+3 && NR!=3) print $3 }') |
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 | |
# Convert Apple Automator "Run Shell Script" action to actual shell script | |
NAME="${${1##*/}%.*}.sh" | |
CDWF="$1/Contents/document.wflow" | |
touch $NAME | |
chmod +x $NAME | |
awk -F'<|>' '/bin\/.*sh/{print "#!"$3; exit}' $CDWF > $NAME |
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 | |
APP="${${0##*/}%-*}; OST="mac"; DAZ="${APP/ium/e}-$OST.zip" | |
URL="https://commondatastorage.googleapis.com/$APP-browser-snapshots/${(C)OST}" | |
ASS="$(curl -s $URL/LAST_CHANGE)" | |
ADA="${$(brew cask info $APP|awk -v ORS=/ '/^(\/| )/{print $1}')%/*}" | |
SCM="$(awk -F'#|}' '/#/{print $3}' $ADA/Contents/Info.plist)" | |
if [ $SCM -lt $ASS ]; then | |
cd $TMPDIR; pkill ${(C)APP} | |
curl -O $URL/$ASS/$DAZ; unzip $DAZ | |
mv -frv ${DAZ%.*}/${$ADA##*/} $ADA |
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 | |
# Download n seconds of RadioRosa stream | |
gtimeout ${1}s curl http://onair15.xdevel.com:8100/ > radiorosa.mp3 | |
# gtimeout ${1}s curl http://onair15.xdevel.com:8072/ > radiorosa.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/zsh | |
MM3U8="live-04.viewer.dacast.com/i/dclive_1@104057/master.m3u8" | |
TJSON="http://services.dacast.com/token/i/b/28193/c/34004.json" | |
TOKEN="$(print $(curl -s "$TJSON" | awk -F'["]' '{print $6}'))" | |
IM3U8="$(curl -s "$MM3U8""$TOKEN" | awk '/m3u8/')" | |
TSSEG="$(curl -s "$IM3U8" | awk '/ts/{match($0,/([0-9]+)_/,a);\ | |
sub(/([0-9]+)_/,"["a[1]"-"a[1]+9"]_");print $0;exit}')" | |
curl --limit-rate 100k "$TSSEG" >> tvl.ts |
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
#!/usr/bin/env zsh | |
zmodload zsh/mathfunc | |
setopt extended_glob | |
BN="${${0##*/}%%.*}" | |
{ | |
NC=(1) | |
echo "strict digraph collatz {" | |
for n in {2..$1}; do | |
if [ ! ${NC[(r)$n]} ]; then |
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 the prime numbers less than n. | |
# for n in {1..$1}; do gfactor $n; done | awk -F'[: ]' '{if($3~$1)print $3}' | |
for n in {1..$1}; do gfactor $n; done | awk -F'[ ]' 'NF==2{printf $2" "}' |
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 | |
# Stream an FLV to AppleTV | |
# using AirPlay mirroring | |
airplay-mirror start | |
URL="guardarefilm.tv/serie-tv-streaming/3506-star-trek-enterprise.html";EP=${1/x/_} | |
open -W -a vlc $(curl $URL|sed -n "s/embed/mobile/;s/-640x360.html/.mp4/;/sd-$EP\"/p"|cut -d\" -f8) | |
airplay-mirror stop |