Skip to content

Instantly share code, notes, and snippets.

View naiquevin's full-sized avatar

Vineet Naik naiquevin

View GitHub Profile
@processone
processone / strophe.websocket.js
Created December 13, 2010 16:04
Websocket support in strophe.js
/** Class: Strophe.WebSocket
* XMPP Connection manager.
*
* Thie class is the main part of Strophe. It manages a BOSH connection
* to an XMPP server and dispatches events to the user callbacks as
* data arrives. It supports SASL PLAIN, SASL DIGEST-MD5, and legacy
* authentication.
*
* After creating a Strophe.Connection object, the user will typically
* call connect() with a user supplied callback to handle connection level
@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
@takumikinjo
takumikinjo / org2doku
Created March 21, 2011 07:19
Convert Emacs org-mode formatted text to Dokuwiki formatted one.
#!/usr/bin/env perl
# Usage
#
# cat <<EOF | ./org2doku
# * heading
#
# - item
# - sub item
#
@davidandrzej
davidandrzej / linearscatter.py
Created May 3, 2011 18:32
Augment 2D scatter plot with linear regression
"""
Augment scatter plot with linear regression fit
David Andrzejewski
"""
import numpy as NP
import numpy.random as NPR
import matplotlib.pyplot as P
import matplotlib.lines as L
from scikits.learn.linear_model import LinearRegression
@Reiot
Reiot / wordpress2octopress.py
Created September 24, 2011 14:21
Wordpress.com xml ==> octopress markdown migration script
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import sys
import os
import re
import yaml
import urllib
import codecs
from datetime import datetime
from BeautifulSoup import BeautifulStoneSoup, Comment
@codeforkjeff
codeforkjeff / solarize.sh
Created November 27, 2011 06:43
shell script for setting gnome-terminal color palette to use Solarized theme
#!/bin/sh
#
# Shell script that configures gnome-terminal to use solarized theme
# colors. Written for Ubuntu 11.10, untested on anything else.
#
# Solarized theme: http://ethanschoonover.com/solarized
#
# Adapted from these sources:
# https://gist.github.com/1280177
# http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/
@pperon
pperon / ring.erl
Created December 22, 2011 18:23
My solution to the Erlang Process Ring Exercise 4-2 in Programming Erlang
-module(ring).
-export([start/3, loop/0]).
%%%
%%% An implementation of an Erlang process ring. This is probably the
%%% Erlang equivalent of breaking your first board in Karate class.
%%%
start(NumMsgs, NumProcs, Msg) ->
UnlinkedRing = create_process([], NumProcs),
@andyhd
andyhd / maybe-monad.js
Created January 16, 2012 01:02
Maybe monad in Javascript
function maybe(value) {
var obj = null;
function isEmpty() { return value === undefined || value === null }
function nonEmpty() { return !isEmpty() }
obj = {
map: function (f) { return isEmpty() ? obj : maybe(f(value)) },
getOrElse: function (n) { return isEmpty() ? n : value },
isEmpty: isEmpty,
nonEmpty: nonEmpty
}

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@tonyoconnell
tonyoconnell / gist:2351492
Last active August 21, 2023 17:35
Install Magento 1.8 With Sample Data By SSH
mkdir demo
cd demo
wget http://www.magentocommerce.com/downloads/assets/1.8.1.0/magento-1.8.1.0.tar.gz
wget http://www.magentocommerce.com/downloads/assets/1.6.1.0/magento-sample-data-1.6.1.0.tar.gz
tar -zxvf magento-1.8.1.0.tar.gz
tar -zxvf magento-sample-data-1.6.1.0.tar.gz
mv magento-sample-data-1.6.1.0/media/* magento/media/
mv magento-sample-data-1.6.1.0/magento_sample_data_for_1.6.1.0.sql magento/data.sql
mv magento/* magento/.htaccess .
chmod o+w var var/.htaccess app/etc