Skip to content

Instantly share code, notes, and snippets.

@vedantk
vedantk / taylor.rkt
Created January 26, 2011 04:39
Taylor Polynomials: generate them in Racket
(require plot)
(define (factorial n)
(if (< n 2) 1 (* n (factorial (- n 1)))))
(define (taylor-poly func n c)
(define (calc-coeff dfn level)
(/ (dfn c) (factorial level)))
(define (find-coeff fn level coeffs)
(if (= level (+ n 1))
@vedantk
vedantk / snowfox.py
Created January 12, 2011 06:23
Why the hell do they have to delay this for so long...
#!/usr/bin/python2
import time
import webbrowser
from datetime import datetime
import urllib2 as url
from BeautifulSoup import BeautifulSoup
site = "http://ftpcontent.worldnow.com/wdrb/news/closings.html"
@vedantk
vedantk / gist:762289
Created January 2, 2011 04:48
.. in which I discover how to cheat AssaultCube, even though I really shouldn't.
[vk@vk assaultcube]$ diff orig_weapon.cpp source/src/weapon.cpp
566c566,569
< hitpush(dam, o, d, from, to, d->weaponsel->type, gib, gib ? 1 : 0);
---
> if (d->weaponsel->type == GUN_SHOTGUN) {
> dam += 15;
> }
> hitpush(dam, o, d, from, to, d->weaponsel->type, gib, gib ? 1 : 0);
925c928
< bool quickwait = attackmillis*3>=gunwait && !(m_arena && m_teammode && arenaintermission);
@vedantk
vedantk / nqueens.py
Created December 19, 2010 08:31
A solution to N-Queens using the Min-Conflicts local search algorithm
#!/usr/bin/python
# A solution to N-Queens using the Min-Conflicts local search algorithm
# Vedant Kumar <[email protected]>
import random
def nqueens(nr):
show(min_conflicts(list(range(nr)), nr), nr)
def show(soln, nr):