Skip to content

Instantly share code, notes, and snippets.

@wagnerpinheiro
wagnerpinheiro / gist:9813301
Created March 27, 2014 17:34
Quick MD5 hash of a string
echo -n 'the_password' | md5sum -
@wagnerpinheiro
wagnerpinheiro / recode-to-utf8.sh
Last active August 29, 2015 13:57
recode all php files from iso-8859-1 to utf-8
#!/bin/bash
find . -type f -name "*.php" -exec recode iso-8859-1..utf-8 '{}' \;
//open links with '#_blank' anchor in a new page
function addBlankTargetForLinks () {
$('a[href^="http"],a[href*="#_blank"]').each(function(){
$(this).attr('target', '_blank');
});
}
$(document).bind('DOMNodeInserted', function(event) {
addBlankTargetForLinks();
});
@wagnerpinheiro
wagnerpinheiro / firewall-state.bat
Last active December 12, 2015 00:38
Disable/Enable windows server 2008 firewall
@echo off
rem Disable/Enable windows server 2008 firewall
if [%1]==[] goto usage
netsh firewall set opmode %1
goto :eof
:usage
@echo firewall-state [enable|disable]
@wagnerpinheiro
wagnerpinheiro / unique_css_colors.sh
Created January 25, 2013 14:29
Finding unique CSS colors with grep and perl
#!/bin/bash
#Finding unique CSS colors with grep and perl
#Just a tiny one-liner I’ve found useful to get unique CSS color values in a style sheet:
#source: http://www.itopen.it/2012/02/14/finding-unique-css-values-with-grep-and-perl/
#------------------
egrep -r '#[a-fA-F0-9]{3,6}+(\s|;)' *.css|perl -ne 'if (m/(#[a-fA-F0-9]{3,6}+)(\s|;)/){print "$1\n";}'|sort|uniq