Skip to content

Instantly share code, notes, and snippets.

nrepl.el wasn't playing very well with Evil-mode(the cursor didn't move to the next line). And this fixed it:
```(defadvice nrepl-return (before switch-to-normal-mode activate)
(evil-execute-in-emacs-state 1))```
@samrat
samrat / gist:3850914
Created October 8, 2012 05:47
Fibonacci numbers with the golden ratio
(define golden-ratio (/ (+ 1 (sqrt 5)) 2))
(define (fib n)
(inexact->exact (round (/ (expt golden-ratio n) (sqrt 5)))))
(define cutA 7)
(define growA 3)
(define cutB 5)
(define growB 2)
(define (attack-monster heads)
(use-sword heads 0 '()))
(define (use-sword n grow s)
(cond ((< n 0) '())
(define cutA 7)
(define growA 3)
(define cutB 5)
(define growB 2)
(define (attack-monster heads)
(use-sword heads 0 null))
(define (use-sword n grow s)
(cond ((< n 0) null)
(define cutA 7)
(define growA 3)
(define cutB 5)
(define growB 2)
(define (attack-monster heads)
(use-sword heads 0 '()))
(define (use-sword n grow s)
(cond ((< n 0) 0)
@samrat
samrat / goodreads_export.py
Created July 19, 2012 16:51
Python file to convert Goodreads-exported CSV to markdown friendly list
import csv
books = csv.reader(open('goodreads_export.csv', 'rb'))
output_file = open('books.md', 'a')
for row in books:
if 'read' in row:
output = "- **"+row[1]+"** by " + row[2] + "\n"
output_file.write(output)
print outpu
@samrat
samrat / rc.xml
Created April 26, 2012 21:06
openbox/rc.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Do not edit this file, it will be overwritten on install.
Copy the file to $HOME/.config/openbox/ instead. -->
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude">
<resistance>
<strength>10</strength>
<screen_edge_strength>20</screen_edge_strength>
</resistance>
<focus>
<focusNew>yes</focusNew>
@samrat
samrat / archive.html
Created March 21, 2012 13:53
_templates
{% extends "base.html" %}
{% block title %}Archive- Samrat Man Singh{% endblock %}
{% block content %}
<div class="container" style="padding-bottom:100px;">
<div class="row">&nbsp;</div>
<div class="row">&nbsp;</div>
<div class="row">
@samrat
samrat / xtremepapers.py
Created March 9, 2012 19:47
xtremepapers.py
"""Downloads all .pdf files when given a URL
"""
from bs4 import BeautifulSoup
import requests
import os
url = \
"http://www.xtremepapers.com/papers/CIE/Cambridge%20International%20A%20and%20AS%20Level/Mathematics%20-%20Further%20(9231)/"
r = requests.get(url).text
@samrat
samrat / .vimrc
Created January 29, 2012 21:22
my vim config. file
call pathogen#infect()
syntax on
filetype plugin indent on
"Basic config.
syntax on " syntax highlighing
filetype on " try to detect filetypes
filetype plugin indent on " enable loading indent file for filetype
set autoindent