Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View vu3rdd's full-sized avatar

Ramakrishnan Muthukrishnan vu3rdd

View GitHub Profile
@vu3rdd
vu3rdd / distinct.rkt
Created June 17, 2012 16:23
distinct?
#lang racket
(require rackunit)
(define (distinct? xs)
(= (set-count (list->set xs)) (length xs)))
(check-equal? (distinct? '()) #t)
(check-equal? (distinct? '(1)) #t)
(check-equal? (distinct? '(1 2)) #t)
(check-equal? (distinct? '(1 1)) #f)
@vu3rdd
vu3rdd / advice.md
Created July 27, 2012 10:18
Advice from a CEO
  • You don't have to be perfect.
  • Try to do a 80-90% solution. Make it better as you go or when a customer demands it.
  • Stick to your strengths.
  • Try your best to work for yourself, life is short.
  • Maximize happiness by reducing the unhappy experiences.
  • avoid contacts with people you don't like or will make you unhappy.
  • start something on your own, as early as possible in your career.
  • If there are constraints (like family, financial etc), try to do consulting.
@vu3rdd
vu3rdd / cs173-practice.rkt
Created September 2, 2012 17:41
map, filter, flatten in racket
#lang racket
(require rackunit)
;; map :: (a -> b -> c) -> [a] -> [b] -> [c]
(define (map f . xs)
(match xs
[(list (list) ...) (list)]
[(list (list x xs ...) ...) (cons (apply f x) (apply map f xs))]))
(check-equal? (map sqr '(1 2 3)) '(1 4 9))
@vu3rdd
vu3rdd / interpret.rkt
Created September 4, 2012 10:14
let, let* and named-let
#lang racket
(require rackunit)
(define (interpret expr)
(match expr
[`(let ,(? (lambda (b) (or (empty? b) (pair? b))) bindings) ,body ...)
(let->combination expr)]
[`(let* ,bindings ,body ...)
(let*->nested-lets expr)]
@vu3rdd
vu3rdd / wat-py.txt
Created October 23, 2012 09:58
Python scoping..
Some notes on the python scope:
Python has a weird scoping problem, which stems from its intention to create a nice
surface syntax and perhaps to satisfy the imperative programming paradigm. This
affects the semantics of the Python programs in unintuitive ways.
Consider the following code:
A.
@vu3rdd
vu3rdd / little-brother-privacy.txt
Last active December 20, 2015 04:08
Crisp description of the concept of "privacy" in Cory Doctorow's book, "Little Brother" (chapter 4).
There's something really liberating about having some corner of your life
that's *yours*, that no one gets to see except you. It's a little like nudity
or taking a dump. Everyone gets naked every once in a while. Everyone has to
squat on the toilet. There's nothing shameful, deviant or weird about either
of them. But what if I decreed that from now on, every time you went to
evacuate some solid waste, you'd have to do it in a glass room perched in
the middle of Times Square, and you'd be buck naked?
Even if you've got nothing wrong or weird with your body -- and how many of
us can say that? -- you'd have to be pretty strange to like that idea. Most
@vu3rdd
vu3rdd / papers.markdown
Last active February 13, 2019 06:01
List of Papers for Bangalore PL/CS paper reading group

Context

This tweet explains it all.

I have a huge pile of papers on my computer waiting to be read. Often I read parts of it immediately after I see the paper, but I forget about it until someone points on another article, how awesome that paper is. I then remember to read it more carefully.

One way to fix it is to work with like minded people and have serious (non-hand wavy) discussion around the paper.

The list below will grow. My hard disk has more papers than I can count. I have carefully chosen a list of very readable papers in the list below. Special thanks for the authors for publishing their great ideas.

@vu3rdd
vu3rdd / sprunge.txt
Created October 18, 2013 04:58
using sprunge from plan9 commandline
http://sprunge.us is a paste service. It is used by the 9front (a fork of plan9) folks (who hangout in the #cat-v channel on irc.freenode.net). To use sprunge from plan9, one could use the commandline http PUT client, hput.
Let us say, you got an error while compiling stuff. This is what I do. I select the area (using mouse key 1, i.e. left key), use mouse key 2 (i.e. middle ket) to "snarf" (plan9 lingo for copy). I then open acme and click the "paste" tag and "put" (acme lingo for save) the file into the disk.
Now to post the file named say "errors.txt", I do this:
term% hpost -u http://sprunge.us -p http://sprunge.us sprunge@errors.txt # hit enter
http://sprunge.us/EUJF
The second line is the response from sprunge.us with the URL.
@vu3rdd
vu3rdd / test.h
Last active December 28, 2015 04:58
ARM gcc structure alignment
#ifndef TEST_DEFINED
#define TEST_DEFINED
#define OFFSET(x, y) &((x *)0)->y
typedef unsigned int __u32;
typedef int __s32;
typedef long long __s64;
typedef unsigned char __u8;