Skip to content

Instantly share code, notes, and snippets.

View boopathi's full-sized avatar
💭
I may be slow to respond.

Boopathi Rajaa boopathi

💭
I may be slow to respond.
View GitHub Profile
@boopathi
boopathi / deploy.php
Last active August 29, 2015 14:05
Github webhook deploy php
<?php
class Deploy {
//
// EDIT ME
// This will be sent as the User Agent to the Meta API. Set this as
// your GITHUB_USERNAME or APPLICATION_NAME
// Documentation: https://developer.github.com/v3/#user-agent-required
//
@boopathi
boopathi / infinite.js
Created February 18, 2014 10:50
A bug with node.js HTTP. Cannot send more than 5 HTTP requests with Node.
var http = require("http");
function inf(i) {
var req = http.request({
method: "GET",
path: "/",
host: "www.google.com",
port: 80
},function() {
console.log(i,"Response received");
inf(i+1);
@boopathi
boopathi / Dockerfile
Created January 17, 2014 21:31
Dockerfile for building Golang application
from ubuntu:12.04
maintainer Boopathi Rajaa <me@boopathi.in>
# Mercurial
run echo 'deb http://ppa.launchpad.net/mercurial-ppa/releases/ubuntu precise main' > /etc/apt/sources.list.d/mercurial.list
run echo 'deb-src http://ppa.launchpad.net/mercurial-ppa/releases/ubuntu precise main' >> /etc/apt/sources.list.d/mercurial.list
run apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 323293EE
# Install dependencies
run apt-get update
@boopathi
boopathi / showbw.py
Created December 3, 2013 15:30
Show bandwidth usage for cPanel users; uses WHM JSON-API
#!/usr/bin/python
import socket, sys
import urllib2, os
from operator import itemgetter
import subprocess, datetime
from time import strftime
debug = True
@boopathi
boopathi / error_adapter.go
Created November 26, 2013 20:57
Error Adapter - Go
func errorAdapter(f func(http.ResponseWriter, *http.Request) error) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
err := f(w, r)
if err != nil {
c.Errorf("Handler returned an error: %s", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
}
PS1='\[\e[0;31m\]$(r=$?; [[ $r == "0" ]] || echo "[$r] ")\[\e[0m\]\[\e[0;36m\]\u\[\e[0m\] \W\[\e[0;33m\]$(__git_branch)\[\e[0m\]> '
@boopathi
boopathi / attack.go
Last active December 19, 2015 23:09
A webpage was trying to get users login details of gmail. So I thought I would just play around. Find the url from the code
package main
import (
"fmt"
"net/http"
"net/url"
"time"
)
type A struct {
@boopathi
boopathi / set_env.sh
Created July 11, 2013 11:53
Set Golang environment before you start compiling go code
#!/bin/bash
###
#
# @usage `source set_env.sh`
# @desc Sets the environment for developers
# @install Put this file into the GO Workspace directory
#
# bash-$ ls workspace/go/
# - set_env.sh*
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
import os
import os.path
import sys
from graphite.render.hashing import ConsistentHashRing
## Settings
# Absolute path to the Graphite Data Directory
DATA_DIR = '/data/graphite/whisper/'
## You need not modify anything below this