Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am bgeron on github.
* I am bgeron (https://keybase.io/bgeron) on keybase.
* I have a public key ASBuC3DoKsMtRJCETDlAncEavA12RVV3iaie6nMQzrf8iAo
To claim this, I am signing this object:
@bgeron
bgeron / hashes.md
Created June 11, 2020 19:48
Hash commitments
  • 91fd1c94dcabe257c1a3b40365c2e200a0c128ee96914bac9220449e08d9b37afc64af38e03afcbc9ae88c05e014d418f2262db918daffb81c80ebae0a09ed6c IMG_3945.MOV
@bgeron
bgeron / common-unicode.sty
Created March 22, 2020 20:52
LaTeX library to enable many unicode symbols.
% common-unicode.sty. (c) 2016-2019, Bram Geron. Version 1.1.
% This is a collection of \DeclareUnicodeCharacter macros, so that you can get
% started using many Unicode characters in your LaTeX files as quickly as
% possible. You need to \usepackage[utf8]{inputenc}.
% You are welcome to use this file according to the CC0 Public Domain
% Dedication, version 1.0 ("CC0 1.0"). You should be able to find more
% information about this licence at <http://creativecommons.org/publicdomain/zero/1.0/>.
@bgeron
bgeron / README.md
Last active March 22, 2020 20:53
Default output of bgeron/character-snippets

The file below is a Visual Studio Code snippets file with a lot of useful Unicode characters that I've gathered over years of doing a PhD in theoretical CS.

I've included the source .toml below it. If you would like to add new snippets easily in TOML format, check out my tool https://github.com/bgeron/character-snippets and just pipe the TOML through it.

If you're planning to use this with LaTeX, then check out this .sty file as well.

@bgeron
bgeron / Cargo.toml
Created December 24, 2019 17:50
Quicksort in Rust
[package]
name = "quicksort-rust"
version = "0.1.0"
authors = ["Bram Geron <bram@bram.xyz>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rand = "0.7.2"
@bgeron
bgeron / img-to-plot-and-csv.py
Last active February 26, 2024 23:18
Converts an image to a scatter plot.
# CC-BY 2.0 by bgeron
from PIL import Image; import matplotlib.pyplot as plt, pandas as pd
a = Image.open("source.png")
b = Image.blend(a, Image.new(a.mode, a.size, "white"), .92).convert(mode="1")
df = pd.DataFrame(((x,-y) for x in range(b.width) for y in range(b.height) if not b.getpixel((x,y))), columns=("x","y"))
# Plot
df.plot.scatter(x=0, y=1, s=5, alpha=.5, c=["#111133"], figsize=(16,16)).set_aspect("equal")
# Save to CSV
df.to_csv(open("out.csv", "w"), index=False)
@bgeron
bgeron / fibs_without_yield.py
Created November 7, 2018 23:55
Fibonacci generators in Python without using the keyword yield
# Python 3.
#
# Use as follows:
#
# for f in fibs_hacky():
# print(f)
import itertools
from docutils import nodes
from docutils.nodes import paragraph, emphasis
import docutils.parsers.rst.directives.admonitions
from docutils.parsers.rst import Directive, directives
from docutils.parsers.rst.roles import set_classes
" ------- SETUP ------ "
def setup(app):
@bgeron
bgeron / README.md
Last active February 15, 2023 19:49
common-unicode.sty

common-unicode.sty

Want to use Unicode in your LaTeX files? Use this package! (Also, you need to \usepackage[utf8]{inputenc}.)

Comment below, or mail me at myfirstname at myfirstname dot xyz.

-- Bram Geron, 21 April 2016.

FAQ: