Skip to content

Instantly share code, notes, and snippets.

@tanzeeb
tanzeeb / .zshrc
Created September 4, 2020 21:53
vi-mode cursors with zsh + starship
eval "$(starship init zsh)"
function _cursor_block() { echo -ne '\e[1 q' }
function _cursor_bar() { echo -ne '\e[3 q' }
function _cursor_beam() { echo -ne '\e[5 q' }
function zle-keymap-select zle-line-init
{
case $KEYMAP in
vicmd) _cursor_block;;
@tanzeeb
tanzeeb / autoscale-test.sh
Created October 30, 2018 22:57
Autoscale Test #2155
#!/usr/bin/env bash
set -e
echo "Running tests"
echo "Changes in helloworld-go"
pushd docs/serving/samples/helloworld-go
git --no-pager diff .
popd
@tanzeeb
tanzeeb / auth.sh
Created October 24, 2014 02:28
Export UAA Access Token as HTTP Authorization Header
export AUTH=`uaac contexts | grep access_token | sed "s/[ \t]*access_token:/Bearer/"`
@tanzeeb
tanzeeb / pws-data-sync.sh
Last active November 4, 2015 19:46
Script to deploy Pivotal CF MS Data Sync to Pivotal Web Services
#!/usr/bin/env bash -ex
id=$RANDOM
start_dir=`pwd`
work_dir=tmp
REDIS_SERVICE=rediscloud
CONFIG_PLAN=30mb
DATA_PLAN=30mb
@tanzeeb
tanzeeb / 0001-fixed-URI.join-specs.patch
Created June 6, 2011 03:13
Rubinius: fix failing URI specs
From e5fa08b75ef35a54f8decc49e49d9de0502fe561 Mon Sep 17 00:00:00 2001
From: Tanzeeb Khalili <tanzeeb@gmail.com>
Date: Sun, 5 Jun 2011 22:43:21 -0400
Subject: [PATCH 1/2] fixed URI.join specs
---
lib/uri/common.rb | 2 +-
lib/uri/generic.rb | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
@tanzeeb
tanzeeb / 0001-fix-failing-specs-in-CGI-Cookie.patch
Created June 5, 2011 07:35
Rubinius: fix failing CGI specs
@tanzeeb
tanzeeb / game_of_life.rb
Created August 2, 2010 10:32
RPCFN #11
class GameOfLife
attr_accessor :state, :height, :width, :rules
def initialize options={}
self.rules = options[:rules] || [ [0,0,0,1,0,0,0,0,0], [0,0,1,1,0,0,0,0,0] ]
self.height = options[:size] || options[:height] || 10
self.width = options[:size] || options[:width] || 10
self.state = options[:seed] || grid { rand(2) }
require 'time'
class BusinessHours
def initialize opening, closing
@hours = Hash.new( [opening, Time.parse(closing)-Time.parse(opening)] )
end
def calculate_deadline interval, drop_off
target = seconds_before_closing( time = Time.parse(drop_off) )
@tanzeeb
tanzeeb / action.rb
Created May 24, 2010 17:50
RPCFN #9
class Action
attr_accessor :name, :terms, :code
def initialize name
@name = name
@terms = []
end
def setup attribute, *args
case attribute
@tanzeeb
tanzeeb / rpcfn8.rb
Created April 15, 2010 20:16
RPCFN #8
#!/usr/bin/ruby
require 'rubygems'
require 'nokogiri'
require 'builder'
# Specify xpath patterns for the different input formats
formats = {
'/people/person' => {
:first => 'first_name',