Skip to content

Instantly share code, notes, and snippets.

View kitallis's full-sized avatar
🍣

Akshay Gupta kitallis

🍣
View GitHub Profile
@kitallis
kitallis / about-batti.md
Last active April 4, 2017 08:29
About Batti and E-waste

The following are the messages we send out usually to create awareness and and also asking ppl to donate e-waste. You can probably circulate them amongst your group, to attain clarity about what we do.

About Batti

Greetings from everyone at Batti! North East India—beautiful and serene, but many homes are yet to get electrical lighting.

Batti is a an initiative of Further & Beyond Foundation. Batti strives to provide basic lighting for North East India’s most remote inhabitants. We have been installing a solar powered systems that give access to artificial light in tribal homes. So far, Batti has reached more than 1000 people in 282 homes. ​ A part of our funds are generated by upcycling and recycling e-waste.

@kitallis
kitallis / egon-download.rb
Last active January 1, 2016 10:49
download all the egon schiele paintings from http://www.doc.ic.ac.uk/~svb/Schiele/
require 'nokogiri'
require 'open-uri'
BASE_PATH = 'http://www.doc.ic.ac.uk/~svb/Schiele'
html_doc = Nokogiri::HTML(open(BASE_PATH) { |url| url.read })
html_doc.xpath('//td//a', 'align' => 'center').each do |image_element|
image_name = image_element.values.first
next if File.file?(image_name)
download_path = File.join(BASE_PATH, image_name)
@kitallis
kitallis / temporary-path-carrierwave.rb
Created December 19, 2013 06:28
create a temporary path for a file in carrierwave, location agnostic - s3/local, so it'll work with tests
def temporary_path
file = Tempfile.new(['temp-creative-image-', ['.', self.image.file.extension].join], :encoding => 'ascii-8bit')
file.write(image.read) if image.file.exists?
file.path
end
@kitallis
kitallis / mars-rover.clj
Created November 9, 2013 21:15
neena and kitallis delve into clj
(ns mars-rover.core)
;
; first: grid size
;
; rest: pairs of 2 lines each, containing rover agenda.
; 1st line for pair:
; rover starting position on the grid
; 2nd line for pair:
; all instructions to move
#!/usr/bin/env bash
# brew install flac
# this gives you flac2mp3
# mkdir ~/scripts
# vim flac2mp34all
for f in *.flac; do
flac2mp3 "$f" v0 && rm "$f"
@kitallis
kitallis / prepend_method.rb
Created February 27, 2013 07:40
Module#prepend replacing :alias_method
class Earphone
def left
puts "Playing on left."
play(0)
end
def right
puts "Playing on right."
play(1)
end
$ git bisect start
$ git checkout recent_known_buggy_commit
$ git bisect bad
$ git checkout old_known_good_commit
$ git bisect good
# run tests, check things, etc.
$ git bisect good/bad
Repeat last two steps until git finds the first bad commit. Then:
@kitallis
kitallis / test_mustache_compilation_engines.rb
Last active October 10, 2015 20:28
benchmarks for .} compilation engines, re-using a spec from temple-mustache
require 'bacon'
require 'temple'
require 'temple/mustache'
require 'benchmark'
require 'musterb'
require 'mustache'
require 'erubis'
class Bacon::Context
on run {input, parameters}
set inputVolume to input volume of (get volume settings)
set curVolume to (get volume settings)
if (inputVolume = 0 and (output muted of curVolume is false)) then
set inputVolume to 100
set volume with output muted
set displayNotification to "Microphone on, speakers off"
else if (inputVolume > 0 and (output muted of curVolume is true)) then