Skip to content

Instantly share code, notes, and snippets.

View mohitsethi's full-sized avatar
🎯
Focusing

Mohit Sethi mohitsethi

🎯
Focusing
View GitHub Profile
@mohitsethi
mohitsethi / phantomjs-linkedin.js
Created April 1, 2017 09:10 — forked from pasiaj/phantomjs-linkedin.js
A phantomjs script to: a) Login to Linkedin.com b) Scrape all your contacts c) Visit all the contacts d) Automatically endorse all contacts' skills.
var auth = {
user: "USERNAME",
pass: "PASSWORD"
};
function ParallelRunner (list, func, runners) {
function createSlots(runners) {
var slots = [];
for (var i = 0; i < runners; i++) {
slots.push( objReturner() );
@mohitsethi
mohitsethi / xvfb
Created January 7, 2017 09:22 — forked from jterrace/xvfb
xvfb init script for Ubuntu
XVFB=/usr/bin/Xvfb
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
@mohitsethi
mohitsethi / pdf-to-tiff.sh
Created November 25, 2016 04:45 — forked from kpdecker/pdf-to-tiff.sh
pdf-to-tiff
#!/bin/sh
# Converts PDF files to TIFF files suitible for antiquated systems.
# Usage:
# $ pdf-to-tiff.sh file1 file2
#
# Installation:
# $ brew install ghostscript
# $ brew install libtiff
# $ brew install --fresh --build-from-source imagemagick --with-libtiff
#
@mohitsethi
mohitsethi / 0_reuse_code.js
Created April 20, 2016 07:57
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mohitsethi
mohitsethi / build.gradle
Created March 10, 2016 10:00 — forked from mychaelstyle/build.gradle
Example Gradle build Java with FindBugs and PMD and CPD
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "maven"
apply plugin: "findbugs"
apply plugin: "pmd"
def defaultEncoding = 'UTF-8'
[compileJava, compileTestJava]*.options*.encoding = defaultEncoding
sourceCompatibility = 1.7
@mohitsethi
mohitsethi / backup.sh
Created February 22, 2016 01:33 — forked from nulltask/backup.sh
mysqldump, mongodump
#!/bin/sh
#
# backup.sh
#
date=`date +%Y-%m-%d-%H-%M-%S`
backup_dir='/path/to/backup/'`hostname`
mongodump
@mohitsethi
mohitsethi / Apache Tomcat 8 Start stop script init.d script
Created February 20, 2016 09:52 — forked from miglen/Apache Tomcat 8 Start stop script init.d script
Apache Tomcat init script (or startup/controll script). Works fine for version 7/8. Read the comments for release history. Feel free to modify, copy and give suggestions. (c) GNU General Public License
#!/bin/bash
#
# description: Apache Tomcat init script
# processname: tomcat
# chkconfig: 234 20 80
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under
@mohitsethi
mohitsethi / README.md
Created February 4, 2016 03:52 — forked from fnichol/README.md
Auto-enable Local HTTP Caching in Test Kitchen

Auto-enable Local HTTP Caching in Test Kitchen

Note: total experiment and hack, looks nasty, could be awesome:

Setup

  • Drop the kitchen.local.yml into $HOME/.kitchen/config.yml
  • Install polipo (with Mac: brew install polipo, with Ubuntu: apt-get install polipo)
  • Drop polipo-start and polipo-console somewhere useful (perhaps $HOME/bin?)
@mohitsethi
mohitsethi / ruby-ldap-sample.rb
Created January 22, 2016 15:30 — forked from jeffjohnson9046/ruby-ldap-sample.rb
Some VERY basic LDAP interaction in Ruby using Net::LDAP.
#######################################################################################################################
# This Gist is some crib notes/tests/practice/whatever for talking to Active Directory via LDAP. The (surprisingly
# helpful) documentation for Net::LDAP can be found here: http://net-ldap.rubyforge.org/Net/LDAP.html
#######################################################################################################################
require 'rubygems'
require 'net/ldap'
#######################################################################################################################
# HELPER/UTILITY METHOD
task setHttpProxyFromEnv {
def map = ['HTTP_PROXY': 'http', 'HTTPS_PROXY': 'https']
for (e in System.getenv()) {
def key = e.key.toUpperCase()
if (key in map) {
def base = map[key]
def url = e.value.toURL()
println " - systemProp.${base}.proxy=${url.host}:${url.port}"
System.setProperty("${base}.proxyHost", url.host.toString())
System.setProperty("${base}.proxyPort", url.port.toString())