Skip to content

Instantly share code, notes, and snippets.

@jaidevd
jaidevd / gramex.yaml
Created August 13, 2021 05:11
Showing Images with FormHandler
url:
home:
pattern: /$YAMLURL/
handler: FunctionHandler
kwargs:
function: img.do
headers:
Content-Type: image/png
@jaidevd
jaidevd / solutions.py
Created June 17, 2020 03:42
Solutions for exercises in Python bootcamp
# List comprehension
x = [i for i in range(1, 21)]
y = [i ** 2 for i in x]
y = [i ** 2 for i in range(1, 21)]
# Median of a list of numbers
def median(x):
x.sort()
L = len(x)
@jaidevd
jaidevd / init.vim
Created June 3, 2020 02:56
NeoVim config
let g:python2_host_prog = '/home/jaidevd/anaconda3/bin/python'
call plug#begin('~/.local/share/nvim/plugged')
" Autocomplete stuff
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
@jaidevd
jaidevd / treemap.json
Created April 29, 2020 14:58
Vega Treemap Spec
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "An example of treemap layout for hierarchical data.",
"width": 960,
"height": 500,
"padding": 2.5,
"autosize": "none",
"scales": [
{
@jaidevd
jaidevd / seattle-temps.json
Created April 27, 2020 14:22
Annual Seattle Temperatures
[{"temp":39.2,"date":"2010-01-01","time":"1:00 am"},{"temp":39.0,"date":"2010-01-01","time":"2:00 am"},{"temp":38.9,"date":"2010-01-01","time":"3:00 am"},{"temp":38.8,"date":"2010-01-01","time":"4:00 am"},{"temp":38.7,"date":"2010-01-01","time":"5:00 am"},{"temp":38.7,"date":"2010-01-01","time":"6:00 am"},{"temp":38.6,"date":"2010-01-01","time":"7:00 am"},{"temp":38.7,"date":"2010-01-01","time":"8:00 am"},{"temp":39.2,"date":"2010-01-01","time":"9:00 am"},{"temp":40.1,"date":"2010-01-01","time":"10:00 am"},{"temp":41.3,"date":"2010-01-01","time":"11:00 am"},{"temp":42.5,"date":"2010-01-01","time":"Noon"},{"temp":43.2,"date":"2010-01-01","time":"1:00 pm"},{"temp":43.5,"date":"2010-01-01","time":"2:00 pm"},{"temp":43.3,"date":"2010-01-01","time":"3:00 pm"},{"temp":42.7,"date":"2010-01-01","time":"4:00 pm"},{"temp":41.7,"date":"2010-01-01","time":"5:00 pm"},{"temp":41.2,"date":"2010-01-01","time":"6:00 pm"},{"temp":40.9,"date":"2010-01-01","time":"7:00 pm"},{"temp":40.7,"date":"2010-01-01","time":"8:00 pm"},{"te
@jaidevd
jaidevd / seattle-temps.csv
Created April 27, 2020 03:17
Seattle temperature data
temp date time
39.2 2010-01-01 1:00 am
39.0 2010-01-01 2:00 am
38.9 2010-01-01 3:00 am
38.8 2010-01-01 4:00 am
38.7 2010-01-01 5:00 am
38.7 2010-01-01 6:00 am
38.6 2010-01-01 7:00 am
38.7 2010-01-01 8:00 am
39.2 2010-01-01 9:00 am
@jaidevd
jaidevd / heatmap.json
Last active April 27, 2020 03:16
Vega Heatmap
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "A heatmap showing average daily temperatures in Seattle for each hour of the day.",
"width": 800,
"height": 500,
"padding": 5,
"title": {
"text": "Seattle Annual Temperatures",
"anchor": "middle",
@jaidevd
jaidevd / date.csv
Created April 23, 2020 14:13
US Presidents
label born died enter leave
Washington 1732-02-22 13:53:28 1799-12-14 11:53:28 1789-04-30 12:53:28 1797-03-04 13:53:28
Adams 1735-10-30 12:53:28 1826-07-04 12:53:28 1797-03-04 13:53:28 1801-03-04 13:53:28
Jefferson 1743-04-13 12:53:28 1826-07-04 12:53:28 1801-03-04 13:53:28 1809-03-04 13:53:28
Madison 1751-03-16 12:53:28 1836-06-28 12:53:28 1809-03-04 13:53:28 1817-03-04 13:53:28
Monroe 1758-04-28 12:53:28 1831-07-04 12:53:28 1817-03-04 13:53:28 1825-03-04 13:53:28
@jaidevd
jaidevd / scatterplot.json
Created April 22, 2020 02:51
Vega scatterplot
{
"$schema": "https://vega.github.io/schema/vega/v4.json",
"description": "https://gramener.invisionapp.com/d/main/#/console/7709561/326727774/preview",
"width": 495,
"height": 320,
"autosize": "fit",
"padding": {
"left": 5,
"top": 25,
"right": 100,
@jaidevd
jaidevd / antonyms.py
Created February 10, 2020 02:42
Wordnet antonyms
#!/usr/bin/env python
# coding: utf-8
# In[1]:
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')