Skip to content

Instantly share code, notes, and snippets.

View Beefster09's full-sized avatar

Justin Snyder Beefster09

  • SuperLeague Gaming
  • United States
View GitHub Profile
[
{ "keys": ["tab"], "command": "indent", "context":
[
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "not_regex_match", "operand": "^$", "match_all": true },
{ "key": "following_text", "operator": "not_regex_match", "operand": "^$", "match_all": true }
]
},
{ "keys": ["shift+tab"], "command": "unindent", "context":
[
@Beefster09
Beefster09 / serve-dir.sh
Last active September 10, 2020 15:44
Bash function for serving any directory with Python
# Little snippet for serving a directory with a simple http server
# This intended to be source'd from .bashrc
function serve-dir {
(
cd "${1:-.}" &&\
python3 -m http.server "${2:-8080}"
)
}
# serve-dir snippet by Justin Snyder
@Beefster09
Beefster09 / array_flatten.py
Created April 12, 2019 05:03
Flatten an arbitrarily nested array with Python
import itertools
def flatten(seq):
if isinstance(seq, list):
return list(itertools.chain.from_iterable(map(flatten, seq)))
else:
return [seq]
@Beefster09
Beefster09 / rando_case1
Created February 8, 2019 23:46
PCG Randomizer Test Cases
[] => LightCastleHallwayLeftChest
[] => AncientWoodsRear
[] => AncientWoodsWestWing
[HylianAxe] => AncientWoodsWaterBasementBottom
[HeartBall, HylianAxe, ProfaneTunic, SuperShard] => END
LightCastleHallwayLeftChest: HeartBall
AncientWoodsRear: ProfaneTunic
AncientWoodsWestWing: SuperShard
AncientWoodsWaterBasementBottom: HylianAxe
@Beefster09
Beefster09 / CapsLockCursor.ahk
Created January 11, 2019 03:40
Autohotkey CapsLock goodness
SetCapsLockState, AlwaysOff
SetScrollLockState
SetNumLockState, AlwaysOn
CapsLock::Send, {blind}{Escape}
CapsLock & j::Send, {blind}{Left}
CapsLock & k::Send, {blind}{Down}
CapsLock & l::Send, {blind}{Right}
CapsLock & i::Send, {blind}{Up}
@Beefster09
Beefster09 / scale.frag
Last active June 30, 2024 22:32
GLSL: smooth pixel scaling
#version 330 core
in vec2 frag_uv;
uniform sampler2D virtual_screen;
uniform float sharpness = 2.0;
out vec4 frag_color;
float sharpen(float pix_coord) {

Set up as in traditional chess

Pawns and Kings can only move classically. Other pieces have the option to move quantumly.

A quantum move is one of the following:

  • split a classical piece into two quantum pieces (a superstate) and move each to a different location. These pieces are negatively entangled
  • move a pair of quantum pieces to different locations
@Beefster09
Beefster09 / riffle.py
Created April 10, 2018 19:16
Riffle Shuffling
import random
def _perfect_riffle():
while True:
yield 0
yield 1
perfect_riffle = _perfect_riffle().__next__
@Beefster09
Beefster09 / init.js
Last active May 1, 2018 17:57
Useful Atom Commands
atom.commands.add('atom-text-editor', 'custom:indent-line', function() {
let editor = atom.workspace.getActiveTextEditor();
if (editor.hasMultipleCursors() || editor.getSelectedText() != '') {
atom.commands.dispatch(this, 'editor:indent-selected-rows');
}
else {
let line = editor.lineTextForBufferRow(editor.getCursorBufferPosition().row).trim();
if (line == '') {
atom.commands.dispatch(this, 'editor:indent');