Skip to content

Instantly share code, notes, and snippets.

View satyarth's full-sized avatar

Satyarth Mishra Sharma satyarth

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def spy(model, sample, layers):
modules = list(model.modules())[1:]
shape = sample.shape
x = Variable(torch.FloatTensor(sample.reshape(1, *shape)))
to_show = []
for i, module in enumerate(modules):
x = module(x)
if i in layers:
to_show.append(x[0, 0].data.numpy())
from PIL import Image, ImageDraw
from math import floor, ceil
from random import randint
image = 'test.jpg'
max_depth = 5
min_split = 4
max_split = 10
def rgb(color):
from model import Model, NotFound, ActionType
# Take an action, add
def add_active_action(self, row):
action_id, user_id, object_id, type = \
row[0], row[1], row[2], ActionType(row[3])
try:
(previous_active_action,) = \
self.query_unique("select action_id from active_actions_view"
@satyarth
satyarth / tretyakov.py
Last active January 20, 2016 03:29
Script to scrape the hi-res tiles of a painting from tretyakovgallery.ru
from bs4 import BeautifulSoup
import urllib.request
from PIL import Image
base_url = "http://www.tretyakovgallery.ru/"
with open('table.txt') as f:
html = f.read()
soup = BeautifulSoup(html)
from bs4 import BeautifulSoup
import urllib
import urllib2
base_url = "https://www.cl.cam.ac.uk/teaching/1415/"
extensions = ['.pdf', '.pptx']
visited = []
def get_html(url):

Keybase proof

I hereby claim:

  • I am satyarth on github.
  • I am satyarth (https://keybase.io/satyarth) on keybase.
  • I have a public key whose fingerprint is 6E30 E0B0 3BC8 C38E 54F0 8F8C FF60 2AC1 9A56 5D51

To claim this, I am signing this object: