Skip to content

Instantly share code, notes, and snippets.

View basus's full-sized avatar

Shrutarshi Basu basus

View GitHub Profile
@basus
basus / jruby-git PKGBUILD
Created February 19, 2011 04:05
PKGBUILD file for building JRuby from Git on Arch Linux
# $Id$
# Maintainer: Shrutarshi Basu <me@basushr.net>
# Contributor: Shrutarshi Basu <me@basushr.net>
pkgname=jruby-git
pkgver=20110218
pkgrel=1
pkgdesc="JRuby is an 100% pure-Java implementation of the Ruby programming language."
url="http://jruby.org/"
license=('CPL' 'GPL' 'LGPL')
@basus
basus / bitfield.c
Created July 26, 2011 22:12
Bitfields in C
/* Some simple demonstration code to show the use of bit fields in C */
#include <stdio.h>
typedef struct {
unsigned int s0 : 1;
unsigned int s1 : 1;
unsigned int s2 : 1;
unsigned int s3 : 1;
unsigned int s4 : 1;
@basus
basus / about.md
Created November 17, 2011 03:31 — forked from blaix/about.md
Programming Achievements: How to Level Up as a Developer

Programming Achievements: How to Level Up as a Developer

  1. Select a particular experience to pursue.
  2. Pursue that experience to completion. (Achievement unlocked!)
  3. Reflect on that experience. Really soak it in. Maybe a blog post would be in order?
  4. Return to Step 1, this time selecting a new experience.

This gist is a fork of this other gist which is itself a fork of a gist from this blog post.

@basus
basus / result.html
Created January 6, 2012 03:10
Org2blog broken shortcode export
I've been a sworn fan of version cont
[sourcecode language="text" light="true"]
function gitify {
status=$(git status 2>/dev/null | tail -n 1)
if [[ $status == "" ]]
then
echo ""
else
echo $(git-
@basus
basus / fizzbuzz.ml
Created April 30, 2013 23:53
Variations of Fizzbuzz in OCaml, translated from the Rust version in "FizzBuzz Revisited" by Lindsey Kuper: http://composition.al/blog/2013/03/02/fizzbuzz-revisited/
(* Variations of Fizzbuzz in OCaml, translated from the Rust version in
"FizzBuzz Revisited" by Lindsey Kuper:
http://composition.al/blog/2013/03/02/fizzbuzz-revisited/ *)
(* The FizzBuzz test proposed by Imran Ghory:
http://imranontech.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/ *)
(* and made famous by Jeff Atwood:
http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html *)
@basus
basus / linc-install.sh
Last active April 14, 2016 14:57
A shell script to install dependencies for and build LINC-Switch
# Shell script to install dependencies for LINC-Switch and build it. The commands
# are what I used to run build LINC-Switch, but I haven't tested this script
# myself. Use at your own peril.
# Install system-level dependencies
sudo apt-get install gcc wget make autoconf openssl libssl-dev libncurses5 \
curl libncurses5-dev git-core bridge-utils libpcap0.8 libpcap-dev \
libcap2-bin uml-utilities
# Use kerl --- a version manager for Erlang OTP --- to build a compatible Erlang
@basus
basus / frenetic.sh
Last active December 24, 2016 18:54
Basic Frenetic Installation script
# This assumes that opam is installed for your platform: http://opam.ocaml.org
# Initialize opam and install the proper compiler
opam init
eval `opam config env`
eval `opam config env`
opam switch install 4.03.0
eval `opam config env`
# Install the frenetic dependecies
let append xs ys =
let rec helper xs ys acc =
match xs,ys with
| [], [] -> List.rev acc
| [], y::ys' -> helper xs ys' ( y::acc )
| x::xs', ys -> helper xs' ys ( x::acc ) in
helper xs ys []
append [1;2;3] [4;5];;
@basus
basus / spmcs.el
Created July 17, 2017 21:09
Snippet of my Spacemacs config showing Merlin usage
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(evil-want-Y-yank-to-eol nil)
'(merlin-command (quote opam))
'(merlin-completion-with-doc t)
'(package-selected-packages
(quote
@basus
basus / topo.tex
Created January 26, 2018 18:07
Drawing network topology diagrams with Tikz
\usepackage{tikz}
\usetikzlibrary{arrows.meta,bending,automata,shapes}
\begin{tikzpicture}[,>={Stealth[round]},shorten >=1pt,auto,semithick]
\tikzstyle{host}=[rectangle,draw=black,minimum size=30pt,inner sep=0pt]
\tikzstyle{switch}=[circle,draw=black,minimum size=30pt,inner sep=0pt]
\tikzstyle{middlebox}=[diamond,draw=black,minimum size=30pt,inner sep=0pt]
\node[host] (h1) at (1,0) {\texttt{h1}};