Skip to content

Instantly share code, notes, and snippets.

View dardo82's full-sized avatar
🏠
Working from home

Michele Venturi dardo82

🏠
Working from home
View GitHub Profile
@dardo82
dardo82 / join-mp4.sh
Last active October 17, 2019 15:21
Join MP4s per subdir
#!/bin/sh
for dir in * do # join MP4 per subdir
txt="$dir.txt"; gfind $dir/*.mp4 -fprintf $txt "file '%p'\\n"
ffmpeg -f concat -safe 0 -i $txt -c copy $dir.mp4; rm -v $txt
done
# ffmpeg -f concat -safe 0 -i <(printf "file '$PWD/%s'\n" ./*.mp4) -c copy output.mp4
@dardo82
dardo82 / fb-ph-dl.sh
Last active September 24, 2017 09:28
FaceBook photo DL
#!/bin/bash
shopt -s expand_aliases; fb=https://m.facebook.com; open $fb/$1/photos; sleep 10
function safari-cli { eval osascript -e \'tell application \"Safari\" to $1\'; }
alias sst='safari-cli "get source of current tab of front window"'
alias sct='safari-cli "close current tab of front window"'
sst | tr \" \\n | grep ^/.*42$ | cut -d\& -f1 | xargs -I {} open $fb{}; sleep 10
mkdir $1; cd $1; for page in {01..40}; do URL=$(sst | tr \" \\n | grep -B1 Size\
| sed -E "s/amp;|\\\//g;q"); curl -v -o $(basename ${URL%\?*}) "$URL"; sct; done
@dardo82
dardo82 / cp-dir-icon.sh
Last active March 12, 2017 17:00
Copy directory icon
#!/bin/sh
DeRez -only icns $1/Icon$'\r' > icon.rsrc; Rez -a icon.rsrc -o $2/Icon$'\r'
SetFile -a C $2; SetFile -a V $2/Icon$'\r'; rm icon.rsrc
# mkdir $2;cd $2;touch Icon$'\r';chflags hidden Icon$'\r';CA="com.apple"
# xattr -wx $CA.FinderInfo "$(xattr -p -x $CA.FinderInfo $1)" .
# xattr -px $CA.ResourceFork $1/Icon$'\r'|xxd -p -r ->Icon$'\r'/..namedfork/rsrc
@dardo82
dardo82 / 3wasonnet-dl.sh
Last active July 30, 2024 14:04
Ewa Sonnet site DL
#!/bin/sh
# Download EwaSonnet's videos and photos.
# for i in $(cat cred.txt); do curl -L -s 3wasonnet.com/tour/do_member_login_acms4.php \
# -d "$(echo $i|sed -E 's/^| / username=/;s/:/\&pass=/')&btn=++Login++"; echo $i; done \
# | sed -n '/already/s/.*>//p'
for n in {1..24};do
curl -Lsu 'odinboy:thebobby' www.3wasonnet.com/members/latest-videos/page/$n/|tr\
@dardo82
dardo82 / ch-dirs-icons.sh
Last active August 3, 2019 01:26
Change folders icons
#!/bin/sh
cd $1; convert 'xc:none[1024x1024]' folder.png; folderify -x 10.8 folder.png
mv folder.iconset/icon_512x512\@2x.png .; rm -frv folder.{ic{,o}ns{,et},png}
find $1 -name Icon^M; cd $dir; icns2png -x -s 1024 Icon^M
convert -transparent white <(compare -fuzz 16% Icon^M_1024x1024x32.png \
$1/icon_512x512\@2x.png -compose src -highlight-color black png:) logo.png
folderify logo.png .; chflags hidden ./Icon^M; rm logo.png
@dardo82
dardo82 / parole.sh
Last active December 13, 2017 00:41
Make words list
#!/bin/zsh
VB="https://dropbox.com/s/mkcyo53m15ktbnp/nuovovocabolariodibase.pdf"
HW=$(curl -s $VB | pdftotext -layout - - | gawk -v RS=', [0-9]?|\n' \
'/^[^A-Z]+$/{if($1~/^[a-z][^\.]+$/)print $1}' | sed -n '/-$/N; s/-\n//; 1!p')
WD="https://it.wiktionary.org/w/index.php?action=raw&title="; PT="parole.txt"
for w in $HW; do echo "$w|${${$(curl -s "$WD$w" | gawk -v RS='{|}' \
'/Link|Tab/{print $1; exit}')#*|}:-$w}"; done > $PT
WP=https://dumps.wikimedia.org/itwiki/latest/itwiki-latest-all-titles-in-ns0.gz
@dardo82
dardo82 / .zshrc@SurfacePro7
Last active May 30, 2025 21:36
ZSH configs
#!/usr/bin/env zsh
# ZSH configuration
# Set shell options.
export SH="${SHELL##*/}"
export SHRC="$HOME/.${SH}rc"
export CORRECT_IGNORE="_*"
@dardo82
dardo82 / ffmpeg-edit.sh
Last active November 22, 2017 04:49
Edit video \w ffmpeg
#!/usr/local/bin/bash
# Edit video with ffmpeg
I=$1; F=${1##*/}; B=${F%.*}; shift; T=($@)
for p in ${T[@]}; do P=(${p/-/ }); N=${B}_[$p].ts
eval "ffmpeg -i $I -ss ${P[0]} -to ${P[1]} -c copy $N"; done
cat $B_*.ts > $B.ts; ffmpeg -i $B.ts -c copy ${B}_edit.mp4; rm -v $B*.ts
@dardo82
dardo82 / wikipedia.sh
Last active November 26, 2017 18:47
Grep WikiPedia titles
#!/bin/bash
# Grep WikiPedia titles
URL="http://tools.wmflabs.org/grep/index.php"; PAT="(^| |\W)$1(\W| |$)"
curl -G -d "lang=it" -d "project=wikipedia" -d "namespace=0" \
-d "redirects=on" --data-urlencode "pattern=$PAT" "$URL" | \
awk -F'<|>' '/^<li/{print $5}' | tr "[A-Z] [[:punct:]]" "[a-z]\n" | sort -u
@dardo82
dardo82 / wifi-passwd.sh
Last active January 9, 2019 14:30
Find Wi-Fi password
#!/bin/sh
airport="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport"
security find-generic-password -w -a $($airport -I | awk '/ SSID: /{print $2}')