Skip to content

Instantly share code, notes, and snippets.

@hannic
hannic / ROT13.sh
Last active January 18, 2023 04:17
ROT13/ROT47 is an example of the Caesar cipher, developed in ancient Rome. Unix command. tr transliterate
# encode
tr 'A-Za-z' 'N-ZA-Mn-za-m' <<<"The Quick Brown Fox Jumps Over The Lazy Dog"
# decode
echo "Gur Dhvpx Oebja Sbk Whzcf Bire Gur Ynml Qbt" | tr '[A-Za-z]' '[N-ZA-Mn-za-m]'
@hannic
hannic / reset.css
Created November 19, 2012 16:55
CSS Browser Resets
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
outline: none;
}
html { height: 101%; } /* always display scrollbars */
@hannic
hannic / font-face.css
Created November 19, 2012 16:56
Custom @font-face Typography
@font-face{
font-family: 'MyFont';
src: url('myfont.eot');
src: url('myfont.eot?#iefix') format('embedded-opentype'),
url('myfont.woff') format('woff'),
url('myfont.ttf') format('truetype'),
url('myfont.svg#webfont') format('svg');
}
h1 { font-family: 'MyFont', sans-serif; }
@hannic
hannic / responsive.css
Created November 19, 2012 16:56
HTML Meta Tags for Responsive Layouts
@media (max-width: 767px) {
.container {
width: 100%;
margin-left: -20px;
padding-right: 20px;
padding-left: 20px;
}
}
/*==================================== PHONES ====================================================*/
@hannic
hannic / media.css
Created November 19, 2012 16:57
HTML5 Embedded Media
<video poster="images/preview.png" width="1280" height="720" controls="controls" preload="none">
<source src="media/video.mp4" type="video/mp4"></source>
<source src="media/video.webm" type="video/webm"></source>
<source src="media/video.ogg" type="video/ogg"></source>
</video>
<audio controls="controls" preload="none">
<source src="music.ogg" type="audio/ogg">
<source src="music.mp3" type="audio/mpeg">
</audio>
@hannic
hannic / selenium-grid-howto.txt
Created December 2, 2012 19:36
selenium grid setup (mac os - ubuntu - windows)
Supports up to 5 concurrent tests from:
1. On hub machine (Mac OS)
java -jar selenium-server-standalone-2.21.0.jar -role hub
2. On node machine (Ubuntu)
java -jar selenium-server-standalone-2.21.0.jar
-role webdriver
@hannic
hannic / JPGtojpg.sh
Created December 2, 2012 19:39
JPGtojpg - regex used by sed command
#!/bin/sh
# regular expression syntax used by the sed command (this syntax is described in more detail in “Regular Expressions Unfettered”)
for i in *.JPG ; do
mv "$i" "$(echo $i | sed 's/\.JPG$/.x/')"
mv "$(echo $i | sed 's/\.JPG$/.x/')" "$(echo $i | sed 's/\.JPG$/.jpg/')"
done
@hannic
hannic / renametoUTF8.sh
Created December 2, 2012 19:41
rename iso to utf8
#!/bin/sh
# Rename ISO filenames to UTF
# This file is copyleft, enjoy!
for arg
do
newfile=`echo "$arg" | iconv -f ISO-8859-1`;mv "$arg" "$newfile";
done
# Convert from code set ISO88592 "input.txt" to UTF8 code set or ASCII and stores the result as "output.txt"
@hannic
hannic / dist2kernel.sh
Created December 2, 2012 19:51
distance matrix to kernel matrix for libsvm
#!/usr/bin/ruby
#
if ARGV.length==0 then
puts "Usage #{$0} inputmatrix classlabels trainlabels gamma"
exit
end
@maxclasses=1000
@hannic
hannic / txt2kernel.sh
Created December 2, 2012 19:58
txt to kernel (libsvm)
#!/usr/bin/ruby
#
if ARGV.length==0 then
puts "Usage #{$0} inputmatrix classlabels gamma"
exit
end
gamma=2**ARGV[2].to_f