Skip to content

Instantly share code, notes, and snippets.

@nikhilweee
nikhilweee / module-batch.py
Last active July 2, 2019 11:47
Getting started with LSTMs in PyTorch
import random
import torch
num_examples = 128
message_length = 32
def dataset(num_examples):
"""Returns a list of 'num_examples' pairs of the form (encrypted, original).
@nikhilweee
nikhilweee / wtc.sh
Last active November 16, 2016 01:10
random-commit-messages
#! /bin/bash
# You can run this script directly from the terminal
# curl -s https://gist.githubusercontent.com/nikhilweee/75ea15afabdfbb18cda625364a9bf9f9/raw/ > /tmp/wtc.sh ; source /tmp/wtc.sh
# Just use `gitcommit` instead of `git commit -m` to get random commit messages from whatthecommit.com
# start
# checking for conflicts
unalias gitcommit
unalias commitmessage
@nikhilweee
nikhilweee / registration_info.py
Last active January 26, 2025 22:54
Get vehicle info from an Indian registration number
import sys
import requests
from bs4 import BeautifulSoup, SoupStrainer
home_url = 'https://parivahan.gov.in/rcdlstatus/'
post_url = 'https://parivahan.gov.in/rcdlstatus/vahan/rcDlHome.xhtml'
# Everything before the last four digits: MH02CL
first = sys.argv[1]
# The last four digits: 0555
second = sys.argv[2]