Skip to content

Instantly share code, notes, and snippets.

@tyhoff
tyhoff / progress_bar_requests_upload.py
Last active May 5, 2024 09:36
Python requests HTTP PUT with tqdm progress bar
from tqdm import tqdm
from tqdm.utils import CallbackIOWrapper
file_path = os.path.abspath(__file__)
upload_url = https://some-bucket.s3.amazonaws.com
file_size = os.stat(file_path).st_size
with open(file_path, "rb") as f:
with tqdm(total=file_size, unit="B", unit_scale=True, unit_divisor=1024) as t:
wrapped_file = CallbackIOWrapper(t.update, f, "read")
@karpathy
karpathy / min-char-rnn.py
Last active May 28, 2024 01:55
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@ake-persson
ake-persson / gist:ca29cca70f0b458aee4d
Last active January 28, 2022 17:43
Homebrew Formula for a Go app

Homebrew Formula for a Go app

These are quick notes from making my own Formula and Tap.

Add go build script to your Git repo

gobuild.sh

#!/bin/bash
@petehamilton
petehamilton / plot-data.r
Last active February 8, 2018 17:43
Plot GoCardless Customers by Location
# Execute with: R --slave -f draw.r
library(maps)
library(mapdata)
library(foreach)
library(doParallel)
# Use the GoCardless font
par(family="Gotham-Book")
@coreylynch
coreylynch / bench_rocsgd.py
Created November 26, 2012 22:08 — forked from pprett/bench_rocsgd.py
Benchmark sklearn RankSVM implementations (now with sofia binding benchmarks)
import itertools
import numpy as np
from sklearn.linear_model import SGDClassifier, SGDRanking
from sklearn import metrics
from minirank.compat import RankSVM as MinirankSVM
from scipy import stats