Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View basus's full-sized avatar

Shrutarshi Basu basus

View GitHub Profile
@basus
basus / WithDefault.cpp
Created March 15, 2023 01:03
Avoiding adding a default method to the subclass
class SuperClass {
void defaultDummyMethod() {
// This is the no-op dummy method that will be overriden in some child class
doNothing();
}
void actualMethod() {
// This has lots of gnarly code, plus a call to the dummy method,
// even though this class doesn't need to call the dummy method.
@basus
basus / keybase.md
Created August 26, 2019 01:15
Keybase verification

Keybase proof

I hereby claim:

  • I am basus on github.
  • I am basus (https://keybase.io/basus) on keybase.
  • I have a public key ASA8O-6_xzXHxTJ5qyHuPHstyRf_LAhoTup5-XF2piBqPQo

To claim this, I am signing this object:

@basus
basus / pollen.makefile
Created June 27, 2019 20:23
Makefile for my pollen-based website
.POSIX:
default: render publish
css: css/theme.css
top: index.html template.html error.html css js/
about: about/index.html about/pollen.rkt
@basus
basus / docker.sh
Created September 13, 2018 18:37
Docker shortcuts
# Start a container from an image, daemonized, with port forwarding.
# This runs whatever CMD the image is set to run.
docker run -d -p 8000:8000 <image name>
# Run a bash shell in a already-running container.
# Exiting this shell will stop the container.
docker exec -it <container name/id> bash
# Restart the container. This is required after exiting a shell running
# on it via the above command. This is also required if a container is
@basus
basus / thompsons.tex
Created January 26, 2018 18:19
Tikz diagram for Thompson's Construction of Finite Automata from Regular Expressions
\usepackage{subcaption,tikz}
\usetikzlibrary{arrows.meta,bending,automata,shapes}
\begin{figure}[t]
\centering
\begin{subfigure}[b]{0.3\textwidth}
\begin{tikzpicture}[->,>={Stealth[round]},shorten >=1pt,auto,semithick]
\tikzstyle{vertex}=[circle,draw=black,minimum size=30pt,inner sep=0pt]
\node[vertex] (q)[initial, initial where=left,initial text={}]
at (1,0) {$q$};
@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}};
@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
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 / 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
@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