Skip to content

Instantly share code, notes, and snippets.

View shirishp's full-sized avatar

Shirish Padalkar shirishp

View GitHub Profile
@shirishp
shirishp / infoq.sh
Created February 7, 2013 16:07
Download videos from infoq
#! /bin/bash
# Author: Shirish Padalkar (https://twitter.com/_Garbage_)
if [ "$#" -ne 1 ]; then
echo "Usage: $0 infoq_presentation_url"
exit 1
fi
url_with_spaces=`curl -A "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10" $1 | grep "<source src=" | tr -dc "[:print:]"`
@shirishp
shirishp / myapp.sh
Created March 5, 2013 09:21
init.d script
#!/bin/bash
### BEGIN INIT INFO
# Provides: appstarted
# Required-Start:$all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts application
# Description: Starts application
@shirishp
shirishp / something.scala
Last active August 29, 2015 14:20
JSONCollection
object CollectionImplicits {
implicit class RichJSONCollection(val self: JSONCollection) extends AnyVal {
def insertWithTimestamp(document: JsObject) = {
self.insert(document ++ Json.obj("updatedAt" -> new java.util.Date().getTime))
}
}
}
@shirishp
shirishp / dilbert-strip-scrapper.js
Last active February 22, 2019 21:17
Scrape Dilbert strips from http://dilbert.com/ for given duration
var request = require("request"),
cheerio = require("cheerio"),
fs = require('fs');
var site = "http://dilbert.com";
var startingPage = "/strip/2005-01-01";
var finalPage = '/strip/2006-01-01';
var nextPage = startingPage;
@shirishp
shirishp / each.rb
Created January 7, 2017 20:30
Each
#!/usr/bin/env ruby
Dir.entries('./').select do |entry|
next unless File.directory? File.join('./', entry, '.git')
if File.directory? File.join('./', entry)
puts "Repo #{entry}..."
cmd = ARGV.join(' ')
Dir.chdir(entry) {
puts `#{cmd}`
}
@shirishp
shirishp / practice.cfg
Last active October 25, 2018 03:17
Counter Strike : Global Offensive practice configuration
// Launch Options
// -novid -high -threads 8 +fps_max 0 -freq 60 -refresh 60 +cl_forcepreload 1 -nod3d9ex -nojoy
// On Mac, save this file in ~/Library/Application\ Support/Steam/steamapps/common/Counter-Strike\ Global\ Offensive/csgo/cfg/ folder
sv_cheats 1;
bot_kick;
mp_warmup_end;
mp_freezetime 0;
mp_roundtime_defuse 60;
sv_grenade_trajectory 1;
@shirishp
shirishp / each.py
Created January 29, 2018 08:51
Each in Python
#!/usr/bin/env python
import os
import sys
from subprocess import call
rootdir = os.getcwd();
command = sys.argv[1:]
files = [f for f in os.listdir('.') if os.path.isdir(f)]
for f in files:
@shirishp
shirishp / keybase.md
Created September 21, 2019 14:01
keybase.md

Keybase proof

I hereby claim:

  • I am shirishp on github.
  • I am shirish (https://keybase.io/shirish) on keybase.
  • I have a public key ASC0sGaA5xLs5cyy4-GsI3RIwpjwzwLvAmu0rid8WcXFTQo

To claim this, I am signing this object: