Skip to content

Instantly share code, notes, and snippets.

View bicccio's full-sized avatar

Fabrizio Morroia bicccio

View GitHub Profile
@bicccio
bicccio / revelation.js
Created March 10, 2012 14:44
revelation pattern
var myarray;
(function () {
var astr = "[object Array]",
toString = Object.prototype.toString;
function isArray(a) {
return toString.call(a) === astr;
}
@bicccio
bicccio / find-base64-occurences
Created November 24, 2012 11:11 — forked from anotheremily/find-base64-occurences
hackers seem to like base64 encoding their php commands
#!/bin/bash
find . -name "*.php" -exec grep "base64" '{}' \; -print &> b64-detections.txt
find . -name "*.php" -exec grep "eval" '{}' \; -print &> eval-detections.txt
@bicccio
bicccio / LICENSE.txt
Last active December 15, 2015 14:49 — forked from 140bytes/LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@bicccio
bicccio / .tmux.conf
Created January 4, 2014 22:37 — forked from snuggs/.tmux.conf
# SCREENSHOT EXAMPLE: http://grab.by/bzg3
##############################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
#############################
@bicccio
bicccio / 0_reuse_code.js
Created August 13, 2014 21:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bicccio
bicccio / discoverlan.sh
Last active August 29, 2015 14:09
discover LAN (mac)
#!/bin/sh
eth=$(ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'| egrep -o -m 1 '^[^\t:]+') && nmap -sP $(ifconfig $eth | grep -w 'inet' | cut -d' ' -f2 | cut -d'.' -f1-3)".1/24"
@bicccio
bicccio / gist:202292732e7d7cc77923
Created December 10, 2014 11:30
alias for update everithing on Mac OS X
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm update npm -g; npm update -g; sudo gem update --system; sudo gem update'
@bicccio
bicccio / crontab
Last active August 29, 2015 14:27 — forked from zlove/crontab
Crontab entry to clean up the Magento sessions directory. Edit php.ini and change session.gc_maxlifetime to adjust how long session data is kept around. From http://stackoverflow.com/a/9631312/186136
0 2 * * * /usr/bin/find /FIXME/PATH/TO/DOMAIN.COM/var/session -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 -exec rm {} \; >/dev/null 2>&1
@bicccio
bicccio / webcrawler.js
Created February 6, 2016 21:29 — forked from amoilanen/webcrawler.js
Simple PhantomJS-based web crawler library
//PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov anton.al.ivanov@gmail.com 2012
//UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler"
//the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist
(function(host) {
function Crawler() {
this.visitedURLs = {};
};
@bicccio
bicccio / gist:087307d1cec9fa0466bfa2a673560554
Created November 20, 2016 22:10 — forked from paullewis/gist:1982121
Mergesort in JavaScript
/**
* An implementation for Mergesort. Less efficient
* than Quicksort. Again, you'd just use Array.sort
* but if you found yourself unable to use that
* there's always this option.
*
* Tests with:
*
* var array = [];
* for(var i = 0; i < 20; i++) {