Skip to content

Instantly share code, notes, and snippets.

View xitij2000's full-sized avatar
🍮
Alive

Kshitij Sobti xitij2000

🍮
Alive
View GitHub Profile
@xitij2000
xitij2000 / edx-dl.py
Created March 9, 2014 20:40
A script to download videos from EdX using aria2 and automatically putting them in a clean folder hierarchy.
# A script that can automatically download videos from Edx
# Currently this is heavily tied to the way my Edx account and my computer is
# set up. It downloads by sending the the download url and download directory
# to aria2 runnig in rpc mode.
# More info here: http://aria2.sourceforge.net/manual/en/html/aria2c.html#rpc-interface
# You can use http://ziahamza.github.io/webui-aria2/ to see download progress
# For now parameters, such as username, password, and which course to download
# can be provided in the script
# I intend to make it more flexible
from __future__ import print_function
@xitij2000
xitij2000 / gist:1447056
Created December 8, 2011 13:56
Dart code to print squares of first 10 numbers.
#import('dart:dom');
class Example {
void run() {
HTMLDocument doc = window.document;
doc.write(square(10));
}
List<int> square(int n) {
var result = new List<int>();
for(int i = 0; i < n; i++) {
result.add(i * i);
@xitij2000
xitij2000 / 10squares.hx.js
Created December 8, 2011 13:52
haXe code to print squares of first 10 numbers.
Main.main = function() {
new Main();
js.Lib.document.write(Main.square(10).join(","));
}
Main.square = function(n) {
var i = 0;
var result = new Array();
{
var _g = i;
while(_g < n) {
@xitij2000
xitij2000 / 10squares.cljs
Created December 8, 2011 13:47
ClojureScript code to print squares of first 10 numbers.
(ns example)
(defn ^:export square [n]
(for [x (range n)]
(* x x)))
(.write js/document
(reduce str
(interpose ","
(square 10))))
@xitij2000
xitij2000 / gist:1447029
Created December 8, 2011 13:43
JavaScript generated from CoffeeScript
var square;
square = function(n) {
var i, _results;
_results = [];
for (i = 1; 1 <= n ? i <= n : i >= n; 1 <= n ? i++ : i--) {
_results.push(i * i);
}
return _results;
};
@xitij2000
xitij2000 / gist:1447020
Created December 8, 2011 13:40
CoffeeScript code to print squares of first 10 numbers
square = (n) -> i * i for i in [1..n]
document.write square 10
@xitij2000
xitij2000 / gist:1303736
Created October 21, 2011 12:41
models.py
class Person(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50, blank=True)
phone = models.CharField(max_length=15, blank=True)
email = models.EmailField(blank=True)
def __unicode__(self):
return self.first_name + " " + self.last_name
class Book(models.Model):