Skip to content

Instantly share code, notes, and snippets.

Greg Werbin gwerbin

View GitHub Profile
gwerbin / # openssl@1.1 - 2020-05-07_11-46-25.txt
Created May 7, 2020
openssl@1.1 on 3.10.0-1062.12.1.el7.x86_64 - Homebrew build logs
View # openssl@1.1 - 2020-05-07_11-46-25.txt
Homebrew build logs for openssl@1.1 on 3.10.0-1062.12.1.el7.x86_64
Build date: 2020-05-07 11:46:25
gwerbin /
Last active Apr 23, 2020
Build KMSCon on Linux Mint 19.3
uname -a | grep --quiet 'Debian\|Ubuntu' || {
echo 'Refusing to run on a potentially incompatible system.'
return 1
# Build dependencies
sudo apt install \
autoconf \
View kbdpad_mk2.json
"name": "KBDPAD-MKII",
"vendorId": "0xA103",
"productId": "0x0006",
"lighting": "qmk_backlight_rgblight",
"matrix": {
"rows": 6,
"cols": 4
"layouts": {
View classif-sim.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import sys
from time import perf_counter
import numpy as np
import torch
import torch.nn.functional as F
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer
from tqdm import tqdm
gwerbin /
Created Sep 26, 2019
Get the column indices out of a sparse array
import numpy as np
from scipy import sparse
x = np.array([
[1, 0, 1],
[0, 0, 1],
[1, 1, 0],
[0, 1, 1]
gwerbin /
Last active Aug 27, 2019
Classes in Python

In Python, an object is a container that holds pieces of data called "attributes". Each attribute has a name.

For example, if you have an object saved in the person variable, writing retrieves the value held in the name attribute.

A class is the "type" of a particular object. An object is an "instance" of a class.

# Create the simplest possible class
class Person:
gwerbin /
Last active Jul 31, 2019
Freenode #python gets frustrated on a Sunday afternoon and rewrites Python.

Freenode #python rewrites Python


The str class should represent a sequence of grapheme clusters, not codepoints. This should lead to less-surprising behavior when working with non-ASCII text.

NOTE: After some more discussion with other individuals, this might be too computationally intensive for "normal" use. It would be better to have a separate set of functions for working with grapheme clusters. How does it work in Swift?


gwerbin /
Created Jun 30, 2019
A more-correct implementation of PriorityQueue
import argparse
import asyncio
import random
import sys
import time
import priorityqueue
gwerbin /
Last active Jun 8, 2019
Find the longest ordered substring in a string
from typing import Sequence, Tuple, TypeVar
from typing_extensions import Protocol
class SupportsGT(Protocol):
def __gt__(self, other):
T = TypeVar('T', bound=SupportsGT)
You can’t perform that action at this time.