Skip to content

Instantly share code, notes, and snippets.

@bgeron
bgeron / hashes.md
Created Jun 11, 2020
Hash commitments
View hashes.md
  • 91fd1c94dcabe257c1a3b40365c2e200a0c128ee96914bac9220449e08d9b37afc64af38e03afcbc9ae88c05e014d418f2262db918daffb81c80ebae0a09ed6c IMG_3945.MOV
@bgeron
bgeron / common-unicode.sty
Created Mar 22, 2020
LaTeX library to enable many unicode symbols.
View common-unicode.sty
% 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 Mar 22, 2020
Default output of bgeron/character-snippets
View README.md

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 Dec 24, 2019
Quicksort in Rust
View Cargo.toml
[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 Dec 18, 2019
Converts an image to a scatter plot.
View img-to-plot-and-csv.py
# 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 Nov 7, 2018
Fibonacci generators in Python without using the keyword yield
View fibs_without_yield.py
# Python 3.
#
# Use as follows:
#
# for f in fibs_hacky():
# print(f)
import itertools
View collapse.py
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 Feb 12, 2017
common-unicode.sty
View README.md

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:

You can’t perform that action at this time.