Skip to content

Instantly share code, notes, and snippets.

View csarrazi's full-sized avatar

Charles Sarrazin csarrazi

View GitHub Profile
@jpantuso
jpantuso / osx_lion_rail_setup.md
Created July 27, 2011 19:51
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL
@n1k0
n1k0 / 404checker.js
Created January 11, 2013 10:55
A CasperJS script to check for 404 & 500 internal links on a given website
/**
* This casper scipt checks for 404 internal links for a given root url.
*
* Usage:
*
* $ casperjs 404checker.js http://mysite.tld/
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42
*/
/*global URI*/
@btiernay
btiernay / Main.java
Last active March 29, 2018 08:57
Example of how one can issue a `splitVector` command in MongoDB 2.4.0 using the Java client when `--auth` is enabled and the requesting user exists in the `admin` db.
import java.net.UnknownHostException;
import com.mongodb.BasicDBObject;
import com.mongodb.BasicDBObjectBuilder;
import com.mongodb.CommandResult;
import com.mongodb.DB;
import com.mongodb.DBObject;
import com.mongodb.Mongo;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
@nfabre
nfabre / Symfony Live Paris.markdown
Last active October 7, 2020 12:27
Slides Symfony Live 2013
@airtonix
airtonix / slugify
Last active December 16, 2015 22:19
slugify for dash (the bash like interpreter on Ubuntu)
#!/bin/sh
#
# Installation
# mkdir ~/bin
# cd ~/bin
# wget http://gist.github.com/raw//5506188/slugify
# chmod +x ~/bin/slugify
#
# Usage
# $ lspci > ~/Desktop/pci-devices-$(slugify `date`).report
@tnolet
tnolet / gist:7361441
Last active December 5, 2018 02:48
Install collectd 5.4 on Centos 6.x and make it spit out cool metrics. Copied from http://linuxdrops.com/install-collectd-statistics-collecter-on-centos-rhel-ubuntu-debian/ and tweaked for your and my pleasure. For all other cool options, check the provided link.
#!/bin/bash
# Perform installation as root
# Install prereqs
yum -y install libcurl libcurl-devel rrdtool rrdtool-devel rrdtool-prel libgcrypt-devel gcc make gcc-c++
# Get Collectd, untar it, make it and install
wget http://collectd.org/files/collectd-5.4.0.tar.gz
tar zxvf collectd-5.4.0.tar.gz
@ardan-bkennedy
ardan-bkennedy / GoMgoSample-1.go
Last active January 31, 2025 09:00
Sample Go and MGO example
type (
// BuoyCondition contains information for an individual station.
BuoyCondition struct {
WindSpeed float64 `bson:"wind_speed_milehour"`
WindDirection int `bson:"wind_direction_degnorth"`
WindGust float64 `bson:"gust_wind_speed_milehour"`
}
// BuoyLocation contains the buoy's location.
BuoyLocation struct {
@christopher-hopper
christopher-hopper / vm-resize-hard-disk.md
Last active August 15, 2024 15:16
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@lyrixx
lyrixx / segfault-finder.php
Last active August 15, 2023 21:17
How to find a segfault in PHP
<?php
register_tick_function(function() {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
$last = reset($bt);
$info = sprintf("%s +%d\n", $last['file'], $last['line']);
file_put_contents('/tmp/segfault.txt', $info, FILE_APPEND);
// or
// file_put_contents('php://output', $info, FILE_APPEND);
});
the 'repackage' command creates a distributable box file from the unpacked box in your ~/.vagrant.d/boxes directory.
Let's say you "vagrant box add" a box named centos.box from an URL
vagrant will extract centos.box in your vagrant home folder (the box format is just a tar file)
in my case ~/.vagrant.d/boxes/centos
In that folder you will see files like :
[root@goll tmp]# ls ~/.vagrant.d/boxes/centos65/0/virtualbox/
box-disk1.vmdk box.ovf metadata.json Vagrantfile