Skip to content

Instantly share code, notes, and snippets.

@atmb4u
atmb4u / urls.py
Created September 24, 2015 04:30
version info for django projects with git
#add this to your urls file
url(r'^version/$', 'api.views.code_version', name='code_version'),
@karpathy
karpathy / min-char-rnn.py
Last active June 28, 2024 06:13
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@atmb4u
atmb4u / simple.py
Created September 26, 2014 04:39
basic helloworld in flask
# import Flask object from flask library
# you can install flask by pip install flask
from flask import Flask
# initialize Flask app with the name of the file
app = Flask(__name__)
# define the url for which the application should send an http response to
@app.route('/')
# plain python function to handle the request
def hello_world():
@atmb4u
atmb4u / മലയാളം.py
Last active December 24, 2015 01:59
A quick proof that python unicode works; and it works beautifully! Python 3.x example.
class സൂചിക:
"""
മലയാളത്തിൽ പൈതോണ്‍ കോഡ് ചെയ്യാം എന്നുള്ളതിനുള്ള തെളിവ്
Proof that python can use malayalam language (Only on Python 3x)
"""
def സൂചിക(സ്വയം):
print(u"പൈതോണ്‍ ഇപ്പോൾ മലയാളത്തിലും !")
സൂചി = സൂചിക()
സൂചി.സൂചിക()
@atmb4u
atmb4u / newmd5.py
Created November 25, 2011 03:03
Basic self modifying code - puts the md5 of parent and last modified time. More info @ http://en.wikipedia.org/wiki/Self-modifying_code
import md5
f = open("newmd5.py","r+")
b = md5.md5(f.read())
# MD5 of the parent: 54062bcee8cdff7b3c3124421f5c5018 Last Modified:2011-11-21 23:28:46.974856
f.seek(60)
import datetime
digest = b.hexdigest()
f.writelines("# MD5 of the parent: "+digest+" Last Modified:"+str(datetime.datetime.now()))
print digest
f.close()