This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script is designed to convert bank statements from pdf to excel. | |
# | |
# It has been tweaked on HDFC Bank Credit Card statements, | |
# but in theory you can use it on any PDF document. | |
# | |
# The script depends on camelot-py, | |
# which can be installed using pip | |
# | |
# pip install "camelot-py[cv]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import subprocess | |
import time | |
import logging | |
# Takes about 8GB | |
ndim = 25_000 | |
logging.basicConfig(format='[%(asctime)s] %(filename)s [%(levelname).1s] %(message)s', level=logging.DEBUG) | |
def get_gpu_usage(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
import getpass | |
import argparse | |
import logging | |
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.support.wait import WebDriverWait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install pypdf | |
from pypdf import PdfReader, PdfWriter | |
from pypdf.generic import NameObject, NumberObject | |
from pypdf.constants import FieldDictionaryAttributes as FA | |
MIN_HEIGHT = 30 | |
reader = PdfReader("locked.pdf") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function replacePDF(item) { | |
// filter annotations, attachments, notes | |
if (!item.isRegularItem()) { | |
return; | |
} | |
let fileExists = []; | |
let oldPDF = null; | |
// filter multiple or existing PDFs | |
const attachmentIDs = item.getAttachments(); | |
for (let itemID of attachmentIDs) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('keydown', function(event) { | |
// Map the "." key with previous image in post. | |
if (event.keyCode === 188) { | |
let backButton = document.querySelector('button[aria-label="Go back"]'); | |
if (backButton) { | |
backButton.click(); | |
} | |
} | |
// Map the "," key with next image in post. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
import spotipy | |
from tqdm import tqdm | |
from spotipy.oauth2 import SpotifyOAuth | |
def get_client(): | |
"""Get Spotify Client.""" |
OlderNewer