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 / 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 / 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 / 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 / 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 / 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 / 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];;