Skip to content

Instantly share code, notes, and snippets.

View davidsalazar's full-sized avatar

David Salazar davidsalazar

  • 15:28 (UTC -05:00)
View GitHub Profile
@davidsalazar
davidsalazar / wtf.sh
Created February 15, 2016 12:27
sort by ipv6 and ipv4
netstat -ntu | awk ' $5 ~ /^(::ffff:|[0-9|])/ { gsub("::ffff:","",$5); print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
echo -n "Deleting ... "
curl -XDELETE http://localhost:9200/test_date
echo ""
echo -n "Create index ... "
curl -XPUT http://localhost:9200/test_date
echo ""
echo -n "Put mapping ... "
curl -XPUT http://localhost:9200/test_date/test/_mapping -d '
{
"test":{
@davidsalazar
davidsalazar / Add business days.php
Created November 2, 2011 20:30
Add business days
public function add_business_days($datetime, $duedays)
{
$i = 1;
while ($i <= $duedays)
{
$next_day = date('N', strtotime('+1 day', $datetime));
if ($next_day == 6 || $next_day == 7)
{
$datetime = strtotime('+1 day', $datetime);
continue;
@davidsalazar
davidsalazar / new_kohana_app.sh
Created September 30, 2011 13:56
Basic installation script for Kohana 3.2
git init
git submodule add git://github.com/kohana/core.git system
git submodule add git://github.com/kohana/database.git modules/database
git submodule add git://github.com/kohana/userguide.git modules/userguide
git submodule add git://github.com/kohana/image.git modules/image
git submodule add git://github.com/kohana/codebench.git modules/codebench
git submodule add git://github.com/kohana/auth.git modules/auth
git submodule add git://github.com/kohana/pagination.git modules/pagination
git submodule add git://github.com/kohana/orm.git modules/orm
@davidsalazar
davidsalazar / gist:1072763
Created July 8, 2011 20:44
Element ready.
element_ready: function(id, callback, interval) {
var interval = interval ? interval : 100;
var check = setInterval(function() {
if (document.getElementById(id))
{
clearInterval(check);
callback();
}
}, interval);
}