Skip to content

Instantly share code, notes, and snippets.

@byteface
byteface / slots.py
Created August 22, 2021 07:57 — forked from Jordan-Cottle/slots.py
Quick demonstration of `__slots__` with inheritance. Subclasses are able to make their own independent decision on whether to use slots or not. Subclasses will use a dynamic `__dict__` instead of the static `__slots__` as usual, even if their parent class uses `__slots__`.
class Foo:
__slots__ = ["spam", "eggs"]
def __init__(self) -> None:
self.spam = "spam"
self.eggs = "eggs"
class Bar(Foo):
def __init__(self):
// Utils
const range = n => [...Array(n).keys()];
const add = ([x0, y0]) => ([x1, y1]) => [x0 + x1, y0 + y1];
const rotate = θ => ([x, y]) => [
Math.round(x * Math.cos(θ) - y * Math.sin(θ)),
Math.round(x * Math.sin(θ) + y * Math.cos(θ))
];
const map = f => g =>
function*() {
for (const v of g()) {
@byteface
byteface / bash_profile.sh
Created August 30, 2019 12:14 — forked from kjbrum/bash_profile.sh
My personal bash profile
#---------------------------------------------------------------------------------------------------------------------------------------
#
# Author: Kyle Brumm
# Description: File used to hold Bash configuration, aliases, functions, completions, etc...
#
# Sections:
# 1. ENVIRONMENT SETUP
# 2. MAKE TERMINAL BETTER
# 3. FOLDER MANAGEMENT
# 4. MISC ALIAS'
@byteface
byteface / Vagrant provision block
Created October 17, 2015 09:08 — forked from tinkerware/Vagrant provision block
Install Latest Java 7 and Java 8 on Ubuntu 14.04 LTS
config.vm.provision "shell", inline: <<-SHELL
apt-get -y -q update
apt-get -y -q upgrade
apt-get -y -q install software-properties-common htop
add-apt-repository ppa:webupd8team/java
apt-get -y -q update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
apt-get -y -q install oracle-java8-installer
apt-get -y -q install oracle-java7-installer
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update