Skip to content

Instantly share code, notes, and snippets.

@Bonno
Bonno / rename
Last active August 29, 2015 14:03
Rename files from commandline
/bin/ls * | awk '{ printf("mv "$0" ")} {gsub(/_/,"."); print $0 }' | bash
wget www.whatever.com/folder/{1..30}.html
@Bonno
Bonno / webserver-response-curl
Last active February 5, 2018 10:44
View webserver response headers
curl -sSL -o /dev/null -D - http://domain.com
-S, --show-error Show an error message if it fails
-L/--location If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response
code), this option will make curl redo the request on the new place.
-o, --output FILE Write output to <file> instead of stdout
-D, --dump-header FILE Write the headers to this file
curl -v -o - -D - http://domain.com
@Bonno
Bonno / http-status-check.sh
Created February 5, 2015 14:08
Check list of domains for their http status codes
#!/bin/bash
while read LINE; do
curl -o /dev/null --silent --head --write-out '%{http_code}' "$LINE"
echo " $LINE"
done < url-list.txt
@Bonno
Bonno / 1_vlc-server
Last active November 26, 2021 05:01
Use VLC as streaming proxy
vlc -vvv http://livestreams.omroep.nl/npo/3fm_vsr-bb --sout "#standard{access=http,mux=asf,dst=192.168.3.31:8080}"
lame -V2 --vbr-new -q0 --lowpass 19.7 <infile> <outfile>
@Bonno
Bonno / m4a-to-mp3
Last active August 29, 2015 14:15
Convert m4a to mp3 with ffmpeg & lame
for /f "delims=" %%a IN ('dir /b *.m4a') do (
ffmpeg -i "%%a" "%%~na.wav"
lame -V2 --vbr-new -q0 --lowpass 19.7 "%%~na.wav" "%%~na.mp3"
del "%%~na.wav"
)
@Bonno
Bonno / mp4-to-wav
Created February 10, 2015 09:24
Convert mp4 to WAV with ffmpeg
ffmpeg -i <infile> -ac 2 -f wav <outfile>
@Bonno
Bonno / .aliases
Last active August 29, 2015 14:15
Webdev cli-aliasses
# Flush magento cache/fullpagecache
alias flush='setopt rmstarsilent && rm -rf var/cache/* && rm -rf var/full_page_cache/* && unsetopt rmstarsilent'
# Return the current branch name
alias repo='git rev-parse --abbrev-ref HEAD'
alias gpo='git push origin'
alias gb='git br'
# Set the upstream for the current branch
alias gbu='git branch --set-upstream `repo` origin/`repo`'
@Bonno
Bonno / replacefilename.sh
Created February 10, 2015 09:46
Replace special character in all files in given location
#!/bin/bash
#FS='
#'
##strip special character: '
character="'"
replace="_"
j=`find $1 -printf "%d\n" | sort -u | tail -n 1`
j=$((j-1))