Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View matthiassturm's full-sized avatar

Matthias Sturm matthiassturm

View GitHub Profile
@matthiassturm
matthiassturm / generatePassword.js
Last active December 15, 2015 23:59
Password generator
var generatePassword=function(len, pool){
len=(typeof(len)!='undefined'?len:32);
pool=(typeof(pool)!='undefined'?pool:'abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_');
for (var i=0, n=pool.length, pw=''; i<len; ++i){
pw+=pool.charAt(Math.floor(Math.random()*n));
}
return pw;
}
@matthiassturm
matthiassturm / .nanorc
Last active December 19, 2015 00:09
My .nanorc
#set autoindent
set brackets ""')>]}"
set matchbrackets "(<[{)>]}"
set nonewlines
set nowrap
set smooth
set tabsize 4
include /usr/share/nano/css.nanorc
include /usr/share/nano/html.nanorc
@matthiassturm
matthiassturm / cropToPal.bash
Created May 9, 2014 09:05
Crop all 16:9 MP4 videos in folder to PAL 4:3
#!/bin/bash
for f in *.mp4; do
mv "$f" "$f".old;
avconv -i "$f".old -vf crop=490:576:115:0 -vcodec libx264 "$f";
done
@matthiassturm
matthiassturm / flv2x264.bash
Last active August 29, 2015 14:01
flv 2 x264/AAC (all files in directory)
#!/bin/bash
for f in *.flv; do
avconv -i "$f" -c:a aac -strict -2 -b:a 128k -c:v libx264 -profile:v baseline ${f%%.flv}.mp4;
done
@matthiassturm
matthiassturm / wc2014countdown.bash
Created May 13, 2014 16:16
Countdown to World Cup 2014 in Brasil
#!/bin/bash
e=1405195200;while [[ $(date +%Y) -ne $e ]];do figlet $(($e-$(date +%s)));sleep 1;clear;done;figlet $e
@matthiassturm
matthiassturm / thumb_create.php
Created May 18, 2014 22:24
Function to create thumbnails (from 2007)
<?php
function thumb_create($p_photo_file, $p_thumb_file, $p_max_size, $p_quality=60)
{
$pic = @imagecreatefromjpeg($p_photo_file);
if ($pic)
{
$thumb = @imagecreatetruecolor($p_max_size, $p_max_size) or die ("Can't create Image!");
$width = imagesx($pic);
@matthiassturm
matthiassturm / moz-button-height-fix.css
Created July 14, 2014 13:21
Mozilla button height fix
::-moz-focus-inner{margin:0;padding:0;border:0}
@matthiassturm
matthiassturm / nodeDepthReveal.css
Created July 21, 2014 11:58
Node Depth Reveal
/* http://www.quora.com/Web-Development/What-are-the-most-interesting-HTML-JS-DOM-CSS-hacks-that-most-web-developers-dont-know-about */
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
@matthiassturm
matthiassturm / resizeToSquare.bash
Created October 25, 2017 12:51
Resize to square and compress
#!/bin/bash
# before running this script, do:
# brew install imagemagick jpegoptim
mkdir output
for f in *.jpg; do
convert -resize '300x300^' -gravity center -crop 300x300+0+0 ./"$f" ./output/"$f"
done
04fbae81d870a955913f48dcc71a3a9d0c183e53ffa97b0469ef5d3834d3bc8a13779c8c6421af3670a8e93fc840489890933658fe1dcd06758bf92d5c52fae007; indiagator