Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / main.py
Created January 3, 2022 07:34
Anand's Gradient Descent
import numpy as np
from sklearn.model_selection import train_test_split
def add_dummy_feature(x):
return np.column_stack((np.ones(x.shape[0]), x))
# Predicting label follows the equation y = Xw, in its vectorized form.
# def predict(X, w):
@jaidevd
jaidevd / spacy-pipelines.ipynb
Created April 20, 2022 05:29
Spacy pipelines
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jaidevd
jaidevd / train.json
Created May 16, 2022 07:42
Sample sentiment analysis training
[{"text":"For the last quarter of 2010 , Componenta 's net sales doubled to EUR131m from EUR76m for the same period a year earlier , while it moved to a zero pre-tax profit from a pre-tax loss of EUR7m .","label":"POSITIVE"},{"text":"$FB gone green on day","label":"POSITIVE"},{"text":"$MSFT SQL Server revenue grew double-digit with SQL Server Premium revenue growing over 30% http:\/\/stks.co\/ir2F","label":"POSITIVE"},{"text":"Costco: A Premier Retail Dividend Play https:\/\/t.co\/Fa5cnh2t0t $COST","label":"POSITIVE"},{"text":"Stockmann and Swedish sector company AB Lindex entered into an agreement on September 30 , 2007 , whereby Stockmann , or a wholly-owned subsidiary of it , will make a public tender offer for all of Lindex 's issued shares .","label":"POSITIVE"},{"text":"The item included restructuring costs of EUR1 .6 m , while a year earlier they were EUR13 .1 m. Diluted EPS stood at EUR0 .3 versus a loss per share of EUR 0.1 .","label":"POSITIVE"},{"text":"A portion , $ 12.5 million , will be recorded
[
{
"text": "#BREAKINGNEWS MALAYSIA AIRLINES FLIGHT #MH17 CONFIRMED SHOT DOWN OVER #DONETSK OBLAST, SHORTLY BEFORE REACHING RUSSIAN AIR SPACE",
"labels": [
{
"start": 14,
"end": 31,
"label": "ORG"
},
{