Skip to content

Instantly share code, notes, and snippets.

@Grynn
Grynn / conv.sh
Created July 18, 2014 03:06
Convert (almost) any video file to streamable MP4 using ffmpeg...
#!/bin/bash
set -e
set -o pipefail
VERBOSE=
MAX_TIME_SECONDS=
function usage {
cat <<EOF
@Grynn
Grynn / realpath.cmd
Created September 13, 2014 11:40
Magic incantation to jump to the realpath of current dir... (windows 7+, needs PHP to be installed and in the path)
@for /f %%i in ('php -r "echo realpath(__DIR__);"') do pushd %%i
@Grynn
Grynn / docker-fs
Created December 13, 2014 18:45
Show filesystem for a running docker container. Call with source ./docker-fs <id of container>
#!/bin/bash
set -e
if [ -z $1 ]; then
echo Usage: docker-fs [short-id \| name]
exit 1;
fi
ID=$(docker inspect -f '{{.Id}}' $1)
@Grynn
Grynn / run-speedtest.sh
Last active August 29, 2015 14:11
Run grynn/speedtest (via Docker) on a random port: curl -sS https://gist.githubusercontent.com/Grynn/638b998df8c6af1b6b66/raw/run-speedtest.sh | bash
#!/bin/bash
set -e
DEBUG=1
while getopts p:h:v? flag; do
case $flag in
p)
opt_p=$OPTARG
;;
php -r "getmxrr('abc.com', $m, $w); $mx = array_combine($w,$m); ksort($mx); echo json_encode(['abc.com'=>$mx],JSON_PRETTY_PRINT);"
#!/bin/bash
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
@Grynn
Grynn / ssh_ping
Created February 5, 2015 09:15
Ping SSH Client
#!/bin/bash
ping $(perl -e '$ENV{"SSH_CLIENT"} =~ m/^(\S+)/; print "$1\n";')
@Grynn
Grynn / keybase.md
Created March 20, 2015 00:12
Keybase proof of id

Keybase proof

I hereby claim:

  • I am grynn on github.
  • I am grynn (https://keybase.io/grynn) on keybase.
  • I have a public key whose fingerprint is 7C92 03B8 2B01 361C C8F6 9D86 4143 B7D7 716C 6CFB

To claim this, I am signing this object:

cat /etc/apache2/sites-available/* /etc/nginx/sites-available/* | perl -ne 'print if (!m/^\s*#/ && m/ServerName|ServerAlias/i);'
#!/bin/bash
while read p; do
(svn list -R "$p" | xargs -I{} echo $p{} | tee -a allfiles.txt) &
done < repos.txt
wait #for above jobs to finish...