Skip to content

Instantly share code, notes, and snippets.

View Fuhrmann's full-sized avatar
:octocat:
here we go

Ricardo Fuhrmann Fuhrmann

:octocat:
here we go
View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@blister
blister / gist:740829
Created December 14, 2010 18:19
Bash script to add a delay to the localhost interface on Linux machines
#!/bin/bash
# Copyright 2010 Eric Ryan Harrison <me@ericharrison.info>
# Inspired by:
# http://daniel.haxx.se/blog/2010/12/14/add-latency-to-localhost/
if [ -n "$1" ]
then
if [ "$1" = "off" ]
then
tc qdisc del dev lo root
@colinux
colinux / subtitles-renamer.sh
Created January 27, 2011 23:21
Rename subtitles files according to tv shows names found in a directory
#!/bin/bash
# Renames subtitles files according to tv shows names found in a directory
# Acceped syntaxes for season/episode are: 304, s3e04, s03e04, 3x04 (case insensitive)
#
# Usage:
# Put this gist somewhere in your $PATH, like /usr/local/bin/subtitles-renamer
# Chmod +x it
# cd ~/YourHolidaysTvShowsWithSubtitles
# subtitles-renamer
@chandlerprall
chandlerprall / threaded_download.py
Created June 9, 2011 17:41
Small Python multi-threaded file downloader
import urllib2
import threading
from Queue import Queue
import sys, os, re
class ThreadedDownload(object):
REGEX = {
'hostname_strip':re.compile('.*\..*?/', re.I)
}
@cballou
cballou / get-ip-address-optimized.php
Created March 26, 2012 00:51
PHP - Advanced Method to Retrieve Client IP Address
<?php
function get_ip_address() {
$ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR');
foreach ($ip_keys as $key) {
if (array_key_exists($key, $_SERVER) === true) {
foreach (explode(',', $_SERVER[$key]) as $ip) {
// trim for safety measures
$ip = trim($ip);
// attempt to validate IP
if (validate_ip($ip)) {
@bradmontgomery
bradmontgomery / dummy-web-server.py
Last active April 15, 2024 14:27
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request:
@msabramo
msabramo / git_prompt_info.zsh
Created April 11, 2012 00:07
The slowness of my zsh prompt when in a git-svn managed directory was killing me. I improved it by removing the git status stuff that slows it down...
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
@x-Code-x
x-Code-x / readme_install_node
Created April 30, 2012 20:52
Install npm node.js on Debian Squeeze / Wheezy / Linux Mint Debian Edition
#Quick cp from http://sekati.com/etc/install-nodejs-on-debian-squeeze
#
#Needed to install TileMill from MapBox
#
#Installs node.js which has npm bundled
#
#Build Dependencies
sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev
@gaelbillon
gaelbillon / .htaccess
Created September 29, 2012 13:56
custom htaccess for speed, cache, gzip, ETags, etc
### ENVIRONMENT VARIABLES ###
SetEnv PHP_VER 5
SetEnv REGISTER_GLOBALS 0
### MAIN DEFAULTS ###
Options All -Indexes
DirectoryIndex index.html index.htm index.php
AddDefaultCharset UTF-8
### MIME TYPES ###
@kapv89
kapv89 / query-logger.php
Last active January 8, 2019 15:21
Log Queries in L4
<?php
Event::listen('illuminate.query', function($query, $bindings, $time) {
static $count;
if(App::make('env') === 'local')
{
$logFile = __DIR__.'/../storage/logs/queries';
ob_start();
var_dump($bindings, $query);
$str = ob_get_clean();
if($count === null)