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 / 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):
@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: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 / 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 / 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 / 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 / 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 / linux-game-save-locations
Last active June 27, 2019 15:01
A JSON file with paths to locations for game saves. (Scraped from PC Gaming Wiki)
[{"path": "~/.config/0ad/", "game": "0 A.D."},
{"path": "~/.local/share/aspyr-media/borderlands the pre-sequel/willowgame/", "game": "Borderlands: The Pre-Sequel"},
{"path": "~/Documents/BotaniculaSaves/settings.txt", "game": "Botanicula"},
{"path": "", "game": "Bridge Constructor"},
{"path": "", "game": "Boson X"},
{"path": "", "game": "Breach & Clear"},
{"path": "~/.Braid/", "game": "Braid"},
{"path": "", "game": "Braveland"},
{"path": "~/.local/share/aspyr-media/borderlands 2/willowgame/config/", "game": "Borderlands 2"},
{"path": "~/.BlocksThatMatterUserDatas/", "game": "Blocks That Matter"},

Keybase proof

I hereby claim:

  • I am xitij2000 on github.
  • I am kshitij_sobti (https://keybase.io/kshitij_sobti) on keybase.
  • I have a public key ASCDSzEM__3x_B4miMNan-U_WpXGxUrYWrxqkaQT19OBigo

To claim this, I am signing this object:

from pathlib import Path
from babel.messages import pofile
from babel.messages.catalog import Catalog
missing = Catalog("ar")
changed = Catalog("ar")
added = Catalog("ar")
asu_django = pofile.read_po(Path("asu/django.po").open())
edx_django = pofile.read_po(Path("edx/django.po").open())