Skip to content

Instantly share code, notes, and snippets.

View gakshay's full-sized avatar

Akshay Gupta gakshay

View GitHub Profile
# !/bin/bash
# run_deamon_process.sh
# to run a deamon process using UNIX Shell
# gakshay$ sh run_cron_job.sh &
# Created by Akshay Gupta on 2010-03-29.
# Non-Copyright 2010 __gakshay__. No rights reserved.
#
MAXVAL=50
i=0
while [ $i -lt $MAXVAL ]
# remote_cocoa_mysql
# this line is very useful when one wants to connect to remote mysql SERVER
# tested for COCOA-MYSQL client or SequelPro client (MAC MySql clients)
ssh -fNg -L 8888:127.0.0.1:3306 ssh_login@Slice-IP-Address
# ssh-login : gakshay
# Slice-IP-Address : gakshay.local
# It usually done through port forwarding from 3306 to 8888 (If I'm right)
# deploy.rb
# sample capistrano deploy file
# USAGE:
# => cap build deploy:setup
# => cap build deploy
# => cap staging restart
# => Do notice after deploy callbacks
task :staging do
role :web, "<server-1>"
# gmail.rb
# script to fetch INBOX mails from an account
#
# PROBLEM: I need to find all the EMAIL-ID and Phone number from a Media Agency's Gmail Account (upto certain number)
# Solutions:
# 1. run the script on some high speed internet server if possible
# 2. Filter out relavant content from gmail.txt using shell (grep and vim)
#
# Created by Akshay Gupta on 2010-03-29.
# Total time taken : 2 hours to complete the task
# file: railscasts.rb
# Author : Akshay Gupta
# First check you have all gems installed. Place the script in /lib folder and run the script.
# I don't have expertize in ruby, please let me know how it can be improved.
# change the path accordingly, where you want to save path
# My working env is on MacOS, one need to make some changes if running on Windows
require 'rubygems'
require 'hpricot'
require 'open-uri'
# sample list gem_list file
beanstalk-client (1.0.2)
bluecloth (2.0.5)
builder (2.1.2)
capistrano (2.5.13)
capistrano-ext (1.2.1)
capistrano_s3 (0.1.1)
cgi_multipart_eof_fix (2.5.0)
columnize (0.3.1)
hg serve -d -p 4001 -a 127.0.0.1
to add a hg app to be served by nginx reverse proxy
@gakshay
gakshay / singleton_logger.rb
Created May 22, 2012 21:48 — forked from cheeyeo/singleton_logger.rb
Simple logger using Ruby's built in Singleton module
require 'singleton'
class SimpleLogger
include Singleton
attr_accessor :level
ERROR=1
WARNING=2
INFO=3