Skip to content

Instantly share code, notes, and snippets.

Avatar

masukomi (a.k.a. Kay Rhodes) masukomi

View GitHub Profile
@masukomi
masukomi / doom.md
Created Sep 21, 2020 — forked from anhedonix/doom.md
Doom Emacs Cheatsheet
View doom.md

Doom Emacs Default keybindings cheetsheet

SPC

  • SPC find file
  • , switch bufferA
  • . browse files
  • : MX
  • ; EX
  • < switch buffer
View graphing.rkt
#lang sicp
; A collection of functions
; that can be added to your functions
; to have them produce graphviz dot notation
; as they're run.
;
; ;-------------
; ; Usage inside functions to be graphed
;
@masukomi
masukomi / fizzbuzz.py
Last active Feb 18, 2020 — forked from Gorcenski/fizzbuzz.py
The most obnoxious solution to FizzBuzz I can imagine.
View fizzbuzz.py
# Emily Gorcensky's "obnoxious" fizz-buzz (less-compact version) annotated for non-python geeks.
# Explanation via Twitter: https://twitter.com/EmilyGorcenski/status/1228407309656903680?s=20
# If you want to dive into the meanings of how it works: it models fizzbuzz by
# computing the isomorphism of the finite cyclic groups of the values of the
# fizzes and buzzes and whatnot.
#
# These abelian groups are mapped to the unit circle in the complex plane and
# Represented as roots of unity. Such a interpetation has a polynomial
# representation. Therefore, the cartesian product in the isomorphism is
# represented as polynomial multiplication. The coefficients of a Polynomial
@masukomi
masukomi / array.rb
Last active May 10, 2019
an implementation of ruby's Flatten ... in ruby
View array.rb
class Array
# Performs the same function as
# flatten, only slower (because it's in Ruby
# and .flatten is implemented in C)
def slow_flatten(arr = self, result = [])
if arr.size > 0
first = arr.first
if ! arr.first.is_a? Array
result.push(first)
else
@masukomi
masukomi / parraleln.cr
Created May 3, 2018 — forked from oprypin/parraleln.cr
Crystal parallel jobs from an array
View parraleln.cr
def paralleln(items : Indexable(T), &block : T -> R) forall T, R
results = Array(R).new(items.size) { r = uninitialized R }
done = Channel(Exception?).new
items.each_with_index do |item, i|
spawn do
begin
results[i] = block.call(item)
rescue e
done.send e
View dylib_handling_build_tool.sh
#!/bin/sh
[insert command to compile your app here]
# copy all the optional ones
rm -rf dylibs/*
# REPLACE path/to/my/new/binary below with the path to your newly compiled binary
DYLIBS=`otool -L path/to/my/new/binary | grep "/opt" | awk -F' ' '{ print $1 }'`
for dylib in $DYLIBS
do
@masukomi
masukomi / gale
Last active Dec 20, 2016
find the last thing edited and add it to git. (Git Add Last Edited)
View gale
#!/bin/sh
# find the last thing edited and add it to git.
# useful when you're editing items in a merge conflict
# and are running a command to edit each file in the command line.
# Run gale after each edit so that the list of conflicting items gets shorter
# and you don't have to keep copy pasting the name of the file
HISTFILE=~/.bash_history
set -o history
View wtf_explanation.txt
extract
┌─────────────────this ──────────────────────────┐
│ column │
│ ▼
│ ┌──┐
│ │ │
│ ┌────────────┼──┼───────┐
View last_thursday_of_the_month.sh
#!/bin/bash
for i in `cal | awk '{print $5}'`; do
if [ "x" != "x"$i ]; then
target_day=$i
fi
done
today=`date | awk '{print $3}'`
View organizing_number_pairs_problem.rb
# I need your help geeks. ;)
# I have an array of items
# Some items have a number on both sides
# I'll call these "matched pairs".
# The matched pairs are the keystones of this problem.
# I need to sort the items between the matched pairs
# in a particular way.
# There's a "from number" and a "to number"