Wednesday, November 12, 2014


If you find that grub-mkrescue -o os.ios is not working ... install xorriso

Tuesday, November 11, 2014

Good HTML5 video

The guy talks about reading and writing files in JS.

Also - mentioned indexdb - which is the persistence solution for webapp

CORS - cross origin resource sharing
EasyXDM  - cross domain messaging  - uses iframe

Sunday, November 9, 2014

Creating a bootable HD image using grub

It is nicely documented here -

#!/bin/sh -x

dd if=/dev/zero of=out.img seek=8MB count=1k bs=1

outlo=`sudo losetup -f --show out.img`

parted -s ${outlo} mklabel msdos

parted  ${outlo} mkpart primary ext2 32k 100% -a minimal

parted ${outlo} set 1 boot on

partx -a ${outlo}

mke2fs ${outlo}p1

mkdir -p /mnt/out

mount -t ext2 ${outlo}p1 /mnt/out

grub-install --boot-directory=/mnt/out/boot/ --modules="ext2 part_msdos" ${outlo}


umount /mnt/out
partx -d ${outlo}p1
losetup -d ${outlo}

Friday, November 7, 2014

Starting a network service on Ubuntu 14.04 at boot

I run an Ubuntu 14.04 VM on my Mac Mini with Yosemite. For some reason I cant get "bridged" network to work so I have to stick to NAT. What I needed was for the VM to start a Remote Port forwarding onto the host Mac at boot - so that I could simply use ssh to log into my VM. I needed answers to the following questions for this -

1. How do I get my networking to start at boot?
I am not sure of this I had to do this - add
auto eth0
iface eth0 inet dhcp

into /etc/network/interfaces

2. Add a cron job to ssh into my mac -


x=`ps -Aef |grep 2222:localhost:22  | grep -v grep`


if [ "$x" = "" ]
echo "Started the service" > $logfile
date >> $logfile 
ssh -N -i /home/kashyap/.ssh/id_rsa -R 2222:localhost:22 &
echo "Service already running" > $logfile
echo "$x" >> $logfile
date >> $logfile

Tuesday, November 4, 2014

Sonic Pi

A nice program for Raspberry Pi- works on regular machines to -

A nice video introduction by the creator -

Sam talks about a couple of things here -

1. Why's programming guide to Ruby - I think it is this -

2. live_loop :loop_name do

3. Examples in sonic pi are cool

Wednesday, January 15, 2014

midi in clojure

It was a pleasant surprise for me to learn that core java ships with midi support. Mix that with clojure and one can have some music up and running really quickly

(ns music.core)

(import 'javax.sound.midi.MidiSystem)

(def synth (. MidiSystem getSynthesizer))

(. synth open)

(def mc (. synth getChannels))

(def instr (. (. synth getDefaultSoundbank) getInstruments))

(def yy (. synth loadInstrument (aget instr 0)))

(defn dhun [c f] (. (aget mc c) noteOn f 40))

(defn tune [f]
  (new Thread (fn [] (loop [] (f) (recur)))))

(def beats (tune (fn [] (dhun 9 40) (Thread/sleep 500))))

(def lead (tune (fn [] (dhun 0 40) (Thread/sleep 500))))

Monday, January 13, 2014

Emacs24 on ubuntu 12.04 LTS

To add this PPA:
$ sudo add-apt-repository ppa:cassou/emacs
$ sudo apt-get update
Then, for emacs-snapshot:
$ sudo apt-get install emacs-snapshot-el emacs-snapshot-gtk emacs-snapshot
*Or*, for emacs24:
$ sudo apt-get install emacs24 emacs24-el

Friday, January 10, 2014

Getting started with clojure on emacs

I found this link to be the most useful -

You need the following things installed -

  1. leiningen -
  2. emacs -

(require 'package) (add-to-list 'package-archives '("marmalade" . "")) (package-initialize) (when (not package-archive-contents) (package-refresh-contents)) (defvar my-packages '(clojure-mode nrepl)) (dolist (p my-packages) (when (not (package-installed-p p)) (package-install p)))

And after that
M-x nrepl-jack-in