Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View sunaku's full-sized avatar

Suraj N. Kurapati sunaku

View GitHub Profile
@sunaku
sunaku / chromeos-vpn
Created April 9, 2014 16:03
chromeos-scripts
#!/bin/bash
#
# Connects to the VPN specified by the given vpnc(1) configuration file and
# then waits for you to interrupt or kill this process, at which time it
# disconnects the VPN. See https://github.com/dnschneid/crouton/wiki/VPNC
#
# Usage: chromeos-vpn VPNC_CONFIGURATION_FILE [OPTIONS_FOR_VPNC...]
#
# Setup: apt-get install vpnc wireless-tools
#
#!/bin/sh
ARGS=$( echo "$*" | sed 's/ -url / -host /; s/ -langselen\>//' )
$HOME/.cisco/hostscan/bin/cstub -log error $ARGS
@sunaku
sunaku / sjsu-course-prereqs.rb
Last active August 29, 2015 14:02
Dumps course prerequisites for the given SJSU (San Jose State University http://www.sjsu.edu/) degree program as a DOT (Graphviz http://www.graphviz.org/) graph. You can play with the resulting graph by pasting it into the Vis.js playground (http://visjs.org/examples/graph/15_dot_language_playground.html) or you can convert it into a PDF with cl…
#!/usr/bin/env ruby
#
# Usage: ruby sjsu-course-prereqs.rb [PROGRAM_INFO_URL]
#
# Dumps course prerequisites for the given SJSU degree program as a DOT graph.
# If no PROGRAM_INFO_URL is given, the M.S. Computer Science program is used:
#
# http://www.sjsu.edu/cs/programs/mscs/program-info/
#
# You can convert the graph into a PDF with clickable course links like this:
@sunaku
sunaku / stay.log
Last active August 29, 2015 14:18
vim-fetch issue #7
calling function fetch#visual(1)
line 1: " get text between last visual selection marks
line 2: " adapted from http://stackoverflow.com/a/6271254/990363
line 3: let [l:startline, l:startcol] = getpos("'<")[1:2]
line 4: let [l:endline, l:endcol] = getpos("'>")[1:2]
line 5: let l:endcol = min([l:endcol, col([l:endline, '$'])]) " 'V' col nr. bug
line 6: let l:endcol -= &selection is 'inclusive' ? 0 : 1
line 7: let l:lines = getline(l:startline, l:endline)
line 8: if visualmode() isnot? 'v' " block-wise selection
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled</title>
@sunaku
sunaku / XTerm
Created December 28, 2009 21:53
! The Desert color scheme, ported to PuTTY from Vim by igvita:
! http://www.igvita.com/2008/04/14/custom-putty-color-themes/
XTerm*vt100.foreground : rgb:ff/ff/ff
XTerm*vt100.background : rgb:33/33/33
XTerm*vt100.cursorColor : rgb:00/ff/00
XTerm*vt100.color0 : rgb:4d/4d/4d
XTerm*vt100.color1 : rgb:55/55/55
XTerm*vt100.color2 : rgb:ff/2b/2b
XTerm*vt100.color3 : rgb:ff/55/55
XTerm*vt100.color4 : rgb:98/fb/98
require 'ember'
module ActionView
module TemplateHandlers
##
# @example Pass template processing options to Ember
#
# ActionView::TemplateHandlers::Ember.options = {
# :unindent => true,
# :shorthand => true,
@sunaku
sunaku / gist:574080
Created September 10, 2010 17:58 — forked from mikz/gist:574015
def quoted_date(value)
base = value.respond_to?(:getutc) ? value.getutc.to_s(:db) : super
usec = sprintf(".%06d", value.usec) if value.respond_to?(:usec)
zone = " #{value.formatted_offset}" if value.respond_to?(:formatted_offset)
"#{base}#{usec}#{zone}"
end
@sunaku
sunaku / testr-spin
Created November 9, 2011 18:32
Simple script to emulate Spin using TestR.
#!/usr/bin/env ruby
# This script emulates [Spin] using [TestR].
#
# Usage: testr-spin serve [-I<LOAD_PATH>]... <OVERHEAD_FILE>...
# Usage: testr-spin push <TEST_FILE> [<TEST_NAME>]...
#
# [Spin]: https://github.com/jstorimer/spin
# [TestR]: https://github.com/sunaku/testr
require 'json'
def self.valid_time?(time)
(0 .. 2359).include? Integer(time)
rescue ArgumentError # invalid integer
false
end