Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
got ci/cd? want some? get in touch

Chetan Sarva chetan

🤖
got ci/cd? want some? get in touch
View GitHub Profile
@chetan
chetan / unwtach.js
Created Jan 31, 2014
github repo unwatch
View unwtach.js
// unwatch all repos containg "foobar"
$("li.subscription-row").each(function(i, row){ if ($(row).find("a.repo-name").text().indexOf("foobar") >= 0) { $(row).find("form.js-unsubscribe-form button").click() } });
View find_missing_proseries_files.rb
#!/usr/bin/env ruby
lines = STDIN.readlines.map{ |s| s.strip.downcase }
# lines = File.read("files.txt").split(/\n/).map{ |s| s.downcase }
files = {}
lines.each{ |s| files[s] = 1 }
lines.each do |s|
if s =~ /^(.*?)\.jn1$/ then
f = $1
View apiview-json_benchmark.txt
user system total real allocations memsize
RABL Ultra Simple 2.660000 0.890000 3.550000 ( 3.557719) 106 8751
AMS Ultra Simple 0.280000 0.010000 0.290000 ( 0.285863) 26 650
Presenters Ultra Simple 0.170000 0.000000 0.170000 ( 0.174525) 24 650
ApiView Ultra Simple 0.190000 0.010000 0.200000 ( 0.196894) 12 842
-------------------------------------------------------------------------------------------------------------------
RABL Simple 14.240000 4.490000 18.730000 ( 18.813523) 590 53565
AMS Simple 1.280000 0.000000 1.280000 ( 1.290985) 105 2726
Presenters Simple 0.690000 0.010000 0.700000 ( 0.690873)
@chetan
chetan / village_voice_bookmarklet.js
Created Aug 25, 2014
bookmarklet for single-page slideshows
View village_voice_bookmarklet.js
// bookmarklet
javascript:var d = $("div.slide"), s = $($.grep($("script"), function(el) { return $(el).text().match(/VVMSlideShow/) })).text().replace(/\s+/g, "");s = s.substring(s.indexOf("photoData:")+10, s.indexOf("pointer:")-1);s = JSON.parse(s);_.each(s, function(v, i) {if (i === "1") return;d.append("<img src='" + v["Photo"] + "' />");});
// expanded version
var d = $("div.slide"),
s = $($.grep($("script"), function(el) { return $(el).text().match(/VVMSlideShow/) })).text().replace(/\s+/g, "");
s = s.substring(s.indexOf("photoData:")+10, s.indexOf("pointer:")-1);
s = JSON.parse(s);
_.each(s, function(v, i) {
if (i === "1") return;
View keybase.md

Keybase proof

I hereby claim:

  • I am chetan on github.
  • I am chetan (https://keybase.io/chetan) on keybase.
  • I have a public key whose fingerprint is 4B9C 048F 5423 B084 3143 68F1 0747 382F 0F4D C0DD

To claim this, I am signing this object:

@chetan
chetan / firefox_shutdown_hook.js
Created Feb 10, 2010
firefox shutdown hook example
View firefox_shutdown_hook.js
var ShutdownHook = {
prefs: PrefsService, // wrapper around XPCOM preferences API
register: function() {
if (this.prefs.shutdownRegistered) {
return;
}
var observerService =
View entourage_growl_notification.scpt
(*
Public Domain, 2010
Chetan Sarva <csarva@pixelcop.net>
http://chetanislazy.com/
See also:
http://blog.entourage.mvps.org/2009/02/use_growl_with_entourage.html (original, help)
http://blog.geekdaily.org/2007/12/growl-for-entou.html (another script, borrowed some ideas)
*)
@chetan
chetan / buildr_linesofcode_extension.rb
Created Feb 23, 2010
fixed LinesOfCode buildr task
View buildr_linesofcode_extension.rb
module LinesOfCode
include Extension
first_time do
# Define task not specific to any projet.
desc 'Count lines of code in current project'
Project.local_task('loc')
end
@chetan
chetan / reduce_deps.rb
Created Feb 27, 2010
reduce buildr spec list
View reduce_deps.rb
#!/usr/bin/ruby
if ARGV.empty? then
puts "usage: reduce_deps.rb <file with dep constants>"
exit
end
deps_file = ARGV[0]
orig_consts = Object.constants
@chetan
chetan / gist:333147
Created Mar 15, 2010
lua script for mysql workbench to clear charset and collation
View gist:333147
function clearCharSetAndCollation()
local schemata = grtV.getGlobal("/wb/doc/physicalModels/0/catalog/schemata")
local s
local tables
local t
for s=1, grtV.getn(schemata) do
print(schemata[s].name .. "\n")
You can’t perform that action at this time.