Skip to content

Instantly share code, notes, and snippets.

View chetan's full-sized avatar
🙌
like my work? sponsor me!

Chetan Sarva chetan

🙌
like my work? sponsor me!
View GitHub Profile
#!/usr/bin/env ruby
files = `ls -1 *.pcap`.split("\n")
threads = []
8.times do
threads << Thread.new do
while not files.empty? do
f = files.pop
@chetan
chetan / mobile_debugger.css
Last active December 16, 2015 07:28
helper for debugging responsive css stuff
/*
via: http://johanbrook.com/design/css/debugging-css-media-queries/
add the following to the header first:
<meta name="viewport" content="width=device-width, initial-scale=1" />
*/
@media only screen and (min-width: 768px) and (max-width: 979px){
body::before{
@chetan
chetan / dreamhost_email_macro.txt
Created March 26, 2013 16:58
iMacros script for creating Dreamhost mailboxes
VERSION BUILD=6011206 RECORDER=CR
URL GOTO=https://panel.dreamhost.com/index.cgi
SET !DATASOURCE users.csv
SET !DATASOURCE_COLUMNS 3
SET !ENCRYPTION NO
SET !DATASOURCE_LINE {{!LOOP}}
TAG POS=2 TYPE=DIV ATTR=TXT:Create<SP>New<SP>Email<SP>Address
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=ID:alias CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=ID:gecos CONTENT={{!COL3}}
@chetan
chetan / pfdel.pl
Created March 14, 2013 17:11
delete messages from postfix queue
#!/usr/bin/perl -w
#
# pfdel - deletes message containing specified address from
# Postfix queue. Matches either sender or recipient address.
#
# Usage: pfdel <email_address>
#
use strict;
@chetan
chetan / .vimrc
Last active December 13, 2015 18:49
minimal .vimrc for server-side editing
colors desert
syntax enable
set noai
set softtabstop=2
set tabstop=2
set shiftwidth=2
set noexpandtab
set backspace=2
set smarttab
@chetan
chetan / list_exts.rb
Created January 25, 2013 01:32
List the gems specified in Gemfile which require a native extension
#!/usr/bin/env ruby
# list all gems in your Gemfile which have a C extension
require 'bundler'
gemfile = []
File.new("Gemfile").readlines.each do |line|
next if line =~ /^\s*#/
if line =~ /gem\s+['"](.*?)['"]/ then
@chetan
chetan / git-summary
Created January 16, 2013 17:50
show the last commit for all branches
#!/usr/bin/env ruby
branches = `git branch -a`
exit 1 if $?.to_i != 0
branches = branches.split(/\n/).map{ |b| b.gsub(/(\*|\->.*$|^\s+| +$)/, '') };
l = branches.max_by{ |b| b.length }.length
branches.each do |branch|
pad = " " * (l-branch.length)
STDOUT.write("#{pad}#{branch} ")
format = [
@chetan
chetan / list_ext.rb
Created December 18, 2012 00:00
List gems which use a C extension
#!/usr/bin/env ruby
# list all gems in your Gemfile which have a C extension
require 'bundler'
gemfile = []
File.new("Gemfile").readlines.each do |line|
next if line =~ /^\s*#/
if line =~ /gem\s+['"](.*?)['"]/ then
@chetan
chetan / require_timing_info.rb
Created December 3, 2012 17:09
display timing info on require calls
exception_notifierrequire 'benchmark'
class LoadTime
attr_accessor :path, :tms
include Comparable
def initialize(path, tms)
@path = path
@tms = tms
end
def <=>(other)
@chetan
chetan / jspwiki-sandbox.txt
Created November 6, 2012 18:07
the remanants of a long dead jspwiki...
jspwiki$ ls -l SandBox.txt
-rwxr--r-- 1 ubuntu ubuntu 2263 Jun 22 2004 SandBox.txt
jspwiki$ cat SandBox.txt
A nice and simple virtual mail setup for linux. The process below describes steps required using Gentoo linux.
Component's used:
- [Postfix|http://www.postfix.org]
- [Cyrus SASL|http://asg.web.cmu.edu/sasl/]
- [Courier IMAP|http://www.inter7.com/index.php?page=courierimap]