Skip to content

Instantly share code, notes, and snippets.

View nithinbekal's full-sized avatar

Nithin Bekal nithinbekal

View GitHub Profile
#! /usr/bin/bash
frame_rate=2
# Process command line options
while getopts "r:" opt; do
case $opt in
r) frame_rate=$OPTARG ;;
\?) echo "Usage: $0 [-r frame_rate] input_file output_file"; exit 1 ;;
esac
@nithinbekal
nithinbekal / README.md
Last active September 11, 2023 13:55
Bookmarklet to copy urls as markdown

Readme

Originally based on this bookmarklet. Updated to only link the issue/PR id for Github urls

Usage

  • Right click bookmarks bar and click "add page"
  • Change name to "Copy URL as markdown"
  • Change url to javascript:, followed by the bookmarklet script.
@nithinbekal
nithinbekal / bit-array-access.txt
Last active August 24, 2016 18:15
Benchmarking BitArray implementation using integer arrays vs Bignum based implementation
Max = 100
**************
Warming up --------------------------------------
bitarray gem 189.696k i/100ms
using Bignum 219.494k i/100ms
Calculating -------------------------------------
bitarray gem 6.614M (± 5.0%) i/s - 33.007M in 5.003185s
using Bignum 12.429M (± 7.5%) i/s - 61.897M in 5.015700s

Keybase proof

I hereby claim:

  • I am nithinbekal on github.
  • I am nithinbekal (https://keybase.io/nithinbekal) on keybase.
  • I have a public key whose fingerprint is 5C1B 7A68 4635 9A18 E70F 9F7C F48B EF3D 354B D59C

To claim this, I am signing this object:

@nithinbekal
nithinbekal / osx-setup.sh
Last active August 29, 2015 14:02
Script used to set up Mac
# Create code and play directories
mkdir -p ~/code/play
# Install brew
# Might need to install XCODE command line tools
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
# Install zsh and reopen terminal
brew install zsh
chsh -s /bin/zsh
@nithinbekal
nithinbekal / imdb-api.rb
Created September 10, 2012 07:29
IMDB API wrapper
require 'net/http'
require 'uri'
require 'json'
require 'ap'
module ImdbApi
BASE_URL = "http://www.deanclatworthy.com/imdb"
def self.search(title)
@nithinbekal
nithinbekal / reseed.rake
Last active June 26, 2020 16:55
Rake task to reset and seed Rails database
# Originally written by Justin French (2008):
# http://justinfrench.com/notebook/a-custom-rake-task-to-reset-and-seed-your-database
#
# Modified to work with Rails 4.
desc 'Raise an error unless development environment'
task :safety_check do
raise "You can only use this in dev!" unless Rails.env.development?
end
# Ruby-CSS - Stylesheets in Ruby code
#
# Usage: ruby ruby_css.rb <somefile.rcss>
# See test.rcss for example.
#
# Worst DSL EVER for stylesheets! DO NOT USE THIS AT WORK! ;-)
class Selector
attr_accessor :name, :properties, :children
@nithinbekal
nithinbekal / ride4ruby.rb
Created January 11, 2011 19:28
Ride4Ruby
require 'hpricot'
require 'net/http'
require 'CGI'
class Place
attr_accessor :city, :state, :zip_code, :longitude, :latitude
def initialize city, state, zip_code, latitude, longitude
@city, @state, @zip_code = city, state, zip_code
@latitude, @longitude = latitude, longitude
@nithinbekal
nithinbekal / index.html
Created December 22, 2010 17:55
HTML5 Todo App source
<!doctype html>
<html>
<head>
<title>My Todo List</title>
<style>
body { background: #0f0f0f; font-family: Tahoma, sans-serif; font-size: 11px; }
header, section, footer { display: block; }
#container { background-color: #eee; margin: 0 auto; width: 300px; border: 4px solid #222; }
header h1 { text-align: center; margin: 0; padding: 15px 0;}
label { display: block; padding-bottom: 5px; text-align: center; }