Skip to content

Instantly share code, notes, and snippets.

View ghoseb's full-sized avatar
🏋️‍♂️

Baishampayan Ghose ghoseb

🏋️‍♂️
View GitHub Profile
@ghoseb
ghoseb / heady-thrill.md
Created September 2, 2012 16:18
The Heady Thrill of Having Nothing to Do

Is constant stimulation hurting our creativity—and the economy? Scott Adams pays tribute to tedium

By Scott Adams

We’ve won the war on boredom! If you have a smartphone in your pocket, a game console in the living room, a Kindle in your backpack and an iPad in the kitchen, you never need to suffer a minute without stimulation. Yay!

@ghoseb
ghoseb / vi-lineage.txt
Last active March 11, 2021 21:51
The lineage of Vi
Colossal Typewriter
by John McCarthy and Roland
Silver for the PDP-1 | Photon typesetter
? | editors by Michael
? \ Barnett & Kalon
Expensive Typewriter CREATE/EDIT \ Kelley for TECO
for PDP-1 by Steve Piner for CTSS \ IBM 704 for PDP-1
/ | / | \ \__ \ by Dan Murphy
/ | / | \ \ \ |
* Expensive Typewriter editors EDITS | MEMO/MODIFY | | VEDIT |
@ghoseb
ghoseb / file_cols.clj
Last active April 10, 2022 17:03
Print the source-line length of a bunch of files as a histogram.
(ns file-cols.core
"Print the source-line length histogram of a bunch of files as a histogram.
Inspired by: https://gist.github.com/rsms/36bda3b5c8ab83d951e45ed788a184f4"
(:require [clojure.java.io :as io]))
(def uni-bar
"Unicode bars for histogram."
["" "▏" "▎" "▍" "▌" "▋" "▊" "▉" "█"])
(def quot-rem-8
@ghoseb
ghoseb / rover.clj
Last active November 9, 2022 03:19
Mars rover problem solved in Clojure.
(ns mars.rover)
;; A squad of robotic rovers are to be landed by NASA on a plateau on
;; Mars.
;; This plateau, which is curiously rectangular, must be navigated by the
;; rovers so that their on-board cameras can get a complete view of the
;; surrounding terrain to send back to Earth.
@ghoseb
ghoseb / cut.clj
Created April 16, 2012 09:32
Cut macro from SRFI-26 in Clojure
;;; http://srfi.schemers.org/srfi-26/srfi-26.html
(defn ^:private cut*
[[a f] form]
(cond
(nil? form) [a f]
(seq? (first form))
(let [[arg-list xform] (cut* [[] '()] (first form))]
(recur [(reduce conj a arg-list) (concat f (list xform))] (next form)))
@ghoseb
ghoseb / factorial.py
Created November 14, 2008 18:58
The evolution of a Python Programmer
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@ghoseb
ghoseb / ns-cheatsheet.clj
Last active May 20, 2024 13:01 — forked from alandipert/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.