Skip to content

Instantly share code, notes, and snippets.

View rnagasam's full-sized avatar

Ramana Nagasamudram rnagasam

  • Stevens Institute of Technology
  • Hoboken, NJ
View GitHub Profile
@shihyu
shihyu / example.c
Created March 28, 2017 14:33 — forked from waveacme/example.c
linux list.h for userspace
#include <stdlib.h>
#include <stdio.h>
#include "list.h"
typedef struct episode {
int epid;
struct list_head list;
} episode_t;
@rakawestu
rakawestu / app.js
Created July 21, 2016 06:59
Node JS and MySQL Example With Pug Templating Engine
var express = require('express');
var mysql = require('mysql');
var app = express();
///
/// Create connection to MySQL database server.
///
function getMySQLConnection() {
return mysql.createConnection({
-- OverloadedStrings is often useful.
:set -XOverloadedStrings
-- Scoped type variables is often useful so we can specify the types
-- of variables (for example, in lambda expressions).
:set -XScopedTypeVariables
-- useful for import from specified package
:set -XPackageImports
@lmullen
lmullen / Makefile
Last active May 30, 2024 09:34
PDF slides and handouts using Pandoc and Beamer
SLIDES := $(patsubst %.md,%.md.slides.pdf,$(wildcard *.md))
HANDOUTS := $(patsubst %.md,%.md.handout.pdf,$(wildcard *.md))
all : $(SLIDES) $(HANDOUTS)
%.md.slides.pdf : %.md
pandoc $^ -t beamer --slide-level 2 -o $@
%.md.handout.pdf : %.md
pandoc $^ -t beamer --slide-level 2 -V handout -o $@
@bpj
bpj / README.md
Last active April 6, 2022 08:40
Pandoc Markdown Quick Reference by Examples

pandoc-quick-ref.markdown

@rberenguel
rberenguel / reddi.py
Last active July 7, 2019 11:22
*reddi.py*: Browse reddit from the command line (you'll have to change the location of your python *reddit*: Bindings to use reddipy from within the acme text editor from plan9ports (Plan 9 from User Space) reddit assumes reddi.py is in the same folder. Change it to suit your tastes. To read a little more about the shell reddit script that drive…
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python
import urllib,json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument( 'subreddit', nargs=1,help="Subreddit to browse, f.e. programming")
args= parser.parse_args()
subreddit = args.subreddit[0]
a = urllib.urlopen('http://www.reddit.com/r/'+str(subreddit)+'/.json')
try:
@davisford
davisford / gist:5039064
Last active February 9, 2022 13:39
git clone into non-empty directory

Let's say you start a project locally, and do some editing.

$ mkdir -p ~/git/foo && cd ~/git/foo
$ touch NEWFILE

Now you decide you want to create a new github repo and track it, but the directory is non-empty so git won't let you clone into it. You can fix this, thusly:

@Eckankar
Eckankar / fib_memo.sml
Created November 4, 2012 16:02
Memoized fibonacci using closures in Standard ML
(* Regular fibonacci *)
fun fib 0 = 0
| fib 1 = 1
| fib n = fib (n-1) + fib (n-2);
(* Fibonacci using closures for memoization *)
local
fun fib_c f n =
case f n of
SOME v => (v, f)