Skip to content

Instantly share code, notes, and snippets.

View gwerbin's full-sized avatar
💭
I might be slow to respond.

Greg Werbin gwerbin

💭
I might be slow to respond.
View GitHub Profile
@YohanObadia
YohanObadia / knn_impute.py
Last active January 25, 2024 14:23
Imputation of missing values with knn.
import numpy as np
import pandas as pd
from collections import defaultdict
from scipy.stats import hmean
from scipy.spatial.distance import cdist
from scipy import stats
import numbers
def weighted_hamming(data):
@kurtbrose
kurtbrose / parsley_examples.py
Last active July 19, 2018 16:03
little parsley examples
# how to separate items in a list from separators
parsley.makeGrammar('''
a_list = ('a':it ','? -> it)*
''', {})('a,a,a').a_list()
# result is ['a', 'a', 'a']
# strict comma-delimeted items (at least one item)
parsley.makeGrammar('''
a_list = 'a':first (',' 'a')*:rest -> [first] + rest
@justjanne
justjanne / Price Breakdown.md
Last active April 11, 2024 22:21 — forked from kylemanna/price.txt
Server Price Breakdown: DigitalOcean, Amazon AWS LightSail, Vultr, Linode, OVH, Hetzner, Scaleway/Online.net:

Server Price Breakdown: DigitalOcean, Amazon AWS LightSail, Vultr, Linode, OVH, Hetzner, Scaleway/Online.net:

Permalink: git.io/vps

$5/mo

Provider Type RAM Cores Storage Transfer Network Price
@WittmannF
WittmannF / compare-svm-kernels.py
Last active March 5, 2024 03:23
Visualization of SVM Kernels Linear, RBF, Poly and Sigmoid on Python (Adapted from: http://scikit-learn.org/stable/auto_examples/classification/plot_classifier_comparison.html)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import make_moons, make_circles, make_classification
from sklearn.svm import SVC
h = .02 # step size in the mesh
@MightyPork
MightyPork / usb_hid_keys.h
Last active May 1, 2024 05:11
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
@memeplex
memeplex / base16.py
Last active March 10, 2019 01:29
Base16 default theme for ipython + pygments + prompt toolkit closely matching vim base16 theme.
# -*- coding: utf-8 -*-
"""
Base16 Default Dark by Chris Kempson (http://chriskempson.com).
IPython Template by Carlos Pita (carlosjosepita@gmail.com).
Created with Base16 Builder by Chris Kempson.
"""
from prompt_toolkit.terminal.vt100_output import _256_colors
@equalsraf
equalsraf / NeovimCygwin.md
Last active May 14, 2021 11:42
Neovim in Cygwin

TLDR; no, libuv doesn't work in Cygwin just yet, see at the bottom.

Requirements

I tested using the master branch (9d3449852bd35c9283948186d0259c1bf73b8579 or later)

I installed the following in the cygwin setup

  • gcc-c++ make cmake pkg-config libtool
@dergachev
dergachev / dergachev-gists-gems.md
Last active October 13, 2020 14:32
Looking for gems buried in my old gists

Looking for gems buried in my old gists

Inspired to do some spring cleaning today, I reviewed my archived gists to see if there's anything noteworthy. I was pleasantly surprised to find a few nuggets buried amongst random error logs and git diffs.

Some of them are interesting technical guides that took hours to write, and it's a shame that they've rotted away in obscurity. Several others were picked up by google, and turns out they even got a few comments and a bunch of stars.

@zmwangx
zmwangx / zsh-separate-stdout-stderr.zsh
Created July 15, 2015 16:20
Zsh save stdout, stderr, and return value to different variables without temp file. The following construct evaluates "$@" and saves output on stdout in the parameter stdout, output on stderr in the parameter stderr, and return value in the parameter return. The idea was based on http://stackoverflow.com/a/18086548/1944784, but this implementati…
# The following construct evaluates "$@" and saves output on stdout in the
# parameter stdout, output on stderr in the parameter stderr, and return value
# in the parameter return.
#
# The idea was based on http://stackoverflow.com/a/18086548/1944784, but this
# implementation is completely race-condition-free. The implementation was
# refined during my exchange with Mathias Fredriksson @mafredri, in
# https://github.com/mafredri/zsh-async/issues/1. See mainly
# https://github.com/mafredri/zsh-async/issues/1#issuecomment-121468958, where
# the advantage of this implementation is explained.
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 20, 2024 16:52
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\