Skip to content

Instantly share code, notes, and snippets.

@talesa
talesa / fill_spreadsheet.html
Last active May 3, 2018 09:47
Simple script to fill in the addresses of objects in column A of a Google Sheets spreadsheet
<!DOCTYPE html>
<html>
<head>
<title>Google Sheets API Quickstart</title>
<meta charset='utf-8' />
<!-- <link rel="stylesheet" type="text/css" href="./mystyle.css"> -->
</head>
<body>
<p>Google Sheets API Quickstart</p>
@talesa
talesa / maze.html
Created July 13, 2017 11:14
Scholastica CS Hero session maze solving workshop
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: #000;
}
</style>
<body>
@talesa
talesa / foppl_temp.clj
Last active August 8, 2017 08:36
Using assoc in foppl example
(let [[G E]
(foppl-query
(defn loopi [i mu] (assoc mu (+ i 1) (sample (normal (get mu i) 1))))
(loop 4 (vector 1 1 1 1 1) loopi))]
(print-graph G)
(:body E))
;;; Vertices V: #{x38089 x38096 x38075 x38082}
;;;
;;; Arcs A: #{}
@talesa
talesa / profiles.clj
Last active August 14, 2017 12:52
Lein profiles.clj config file
{:user
{:plugins [[lein-exec "0.3.6"]
[lein-gorilla "0.4.0"]]
:dependencies [[proto-repl "0.3.1"]]}}
@talesa
talesa / adjacency-list-to-adjacency-matrix.py
Last active July 10, 2023 13:11
Transforming Excel adjacency list to a adjacency matrix
# coding: utf-8
# Importing libraries
# In[1]:
import pandas as pd
import numpy as np
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@talesa
talesa / pump_dump.py
Last active March 17, 2021 12:32
Short script to for pump and dumps, you have to execute this code line by line so use `jupyter notebook` or `hydrogen` inside `atom` editor
# you have to execute this code line by line so use jupyter notebook or hydrogen inside atom editor
# import libraries
import ccxt
from datetime import datetime
# create exchange API handle
exchange = getattr(ccxt, 'binance')()
# paste in your API key and secret here (if you're afraid they're gonna get stolen, inspect the ccxt library open source code on github)
exchange.apiKey = ''
@talesa
talesa / check_balance.py
Created January 7, 2018 18:51
Script to check balances across exchanges implemented in `ccxt`
import asyncio
import ccxt.async as ccxt
from collections import defaultdict
exchanges = list()
exchanges.append(('binance', apiKey, secret))
exchanges.append(('livecoin', apiKey, secret))
tasks = list()
tasks += [ccxt.coinmarketcap({'timeout':100000}).fetch_tickers(params={'limit':0})]
@talesa
talesa / b14_change_of_variables.py
Created April 23, 2018 11:13
b14 change of variables plot
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import scipy.special as special
import scipy
plt.rcParams["figure.figsize"] = (16,10)
@talesa
talesa / minimize_kl_between_distributions.py
Last active March 19, 2019 09:45
Simple script to minimize KL between distributions using PyTorch
import torch
from torch import tensor
import torch.distributions as td
import torch.optim as optim
import matplotlib.pyplot as plt
from torch import isinf, isnan
from tqdm import tqdm as tqdm
import numpy as np
import scipy.stats