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 / 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
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 / .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))
@Bonno
Bonno / stripspaces.sh
Created February 10, 2015 09:47
Replace spaces in all files in given location
if [ -n "$1" ]
then
if [ -d "$1" ]
then
cd "$1"
else
echo invalid directory
exit
fi
fi
@Bonno
Bonno / delete_files
Last active August 29, 2015 14:17
Delete Directory and Files In Directory
<?php
/*
* PHP delete function that deals with directories recursively
* Snippet from http://www.paulund.co.uk/php-delete-directory-and-files-in-directory
*
* @author Paulund http://www.paulund.co.uk/
* @author Lewis Cowles
*/
function delete_files($target) {
if(is_dir($target)){
@Bonno
Bonno / keybase.md
Created April 13, 2015 08:19
My Keybase identity

Keybase proof

I hereby claim:

  • I am Bonno on github.
  • I am bonno (https://keybase.io/bonno) on keybase.
  • I have a public key whose fingerprint is 18D4 7BEA 569A E077 8C67 CC1C 7832 7EFB DF6C 99DF

To claim this, I am signing this object: