Skip to content

Instantly share code, notes, and snippets.

View IlyaOrson's full-sized avatar
🦏
Wandering

Ilya Orson IlyaOrson

🦏
Wandering
View GitHub Profile
@sanzoghenzo
sanzoghenzo / compare.py
Last active April 12, 2024 04:48
Compare Excel sheets with Pandas
"""
Compare two Excel sheets
Inspired by https://pbpython.com/excel-diff-pandas-update.html
For the documentation, download this file and type:
python compare.py --help
"""
import argparse
import pandas as pd
"""Provides methods around syncing and usage of AWS s3 buckets as local caches rather than individually
downloading every file"""
import os
import shutil
import boto3 as boto
import multiprocessing
import copy
import hashlib
@mbostock
mbostock / .block
Created August 11, 2017 17:31
Municipalities of Mexico II
border: no
height: 600
license: gpl-3.0
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@brendanvinson
brendanvinson / L.TopoJSON.js
Last active September 29, 2023 00:14 — forked from rclark/L.TopoJSON.js
TopoJSON Leaflet plugin
/*
First run npm install topojson --save and then link "node_modules/topojson/build/topojson.min.js"
above this snippet in your html.
Usage: http://leafletjs.com/reference.html#geojson
*/
L.TopoJSON = L.GeoJSON.extend({
addData: function (data) {
var geojson, key;
@rogerhub
rogerhub / edmonds.py
Created January 9, 2014 22:16
An implementation of Edmond's Blossom Algorithm.
#!/usr/bin/env python
class Vertex:
def __init__(self, value):
self.value = value
self.edges = {}
def degree(self):
return len(self.edges)
def __str__(self):
return str(self.value)
@MikeInnes
MikeInnes / startup.jl
Last active February 5, 2023 12:54
Some useful macros for Julia
# Repeat an operation n times, e.g.
# @dotimes 100 println("hi")
macro dotimes(n, body)
quote
for i = 1:$(esc(n))
$(esc(body))
end
end
end
@jiahao
jiahao / setup_julia.sh
Last active January 20, 2022 03:43
Setting up Julia on an Amazon EC2 instance
#Set up data partition
sudo mkdir /data
sudo chmod 777 /data
sudo "echo /dev/xvdb /data ext4 rw,user,exec,comment=cloudconfig 0 2 >> /etc/fstab"
sudo mount /data
#Install build environment
sudo sed -i "s/enabled=0/enabled=1" /etc/yum.repos.d/epel.epo
sudo yum -y update
sudo yum -y upgrade
@gizmaa
gizmaa / Plot_Examples.md
Last active April 12, 2024 14:18
Various Julia plotting examples using PyPlot
@rclark
rclark / L.TopoJSON.js
Last active December 7, 2022 00:23
TopoJSON-aware Leaflet layer
/*
You'll need something like this in your HTML:
<script src="http://d3js.org/topojson.v1.min.js"></script>
*/
L.TopoJSON = L.GeoJSON.extend({
addData: function(jsonData) {
if (jsonData.type === "Topology") {
for (key in jsonData.objects) {
geojson = topojson.feature(jsonData, jsonData.objects[key]);