Skip to content

Instantly share code, notes, and snippets.

View codehearts's full-sized avatar
🦀
falling in love with a crab

Katie codehearts

🦀
falling in love with a crab
View GitHub Profile
@codehearts
codehearts / forkonacci.c
Last active October 16, 2015 01:00
Poking fun at how recursion is taught as the holy grail of CS in entry-level courses.
/**
* Poking fun at how recursion is taught as the holy grail in entry-level CS.
* This forks a process for each recursive computation and uses the return
* status as the return value.
*
* Running this might be a really bad idea!
*/
#include <unistd.h>
#include <stdlib.h>
@codehearts
codehearts / jot.vim
Last active July 4, 2018 08:01
Vim Colors
" Jot
" Author: Kate Hart
"
" Colors:
" Background: #f9ffff
" Normal: #262626
" Light: #b6b6b6
" Highlight: #0c9cf0
" Light: #e4ecf0
" Dark: #0e5591
@codehearts
codehearts / checkpw.sh
Created June 13, 2018 17:02
Check a password against pwnedpasswords.com using k-anonymity
checkpw() {
local pw sha shortsha suffixsha breachcount
read -srp '> ' pw
sha="$(echo -n "$pw" | sha1sum | cut -d' ' -f1)"
shortsha="$(echo -n "$sha" | cut -c-5)"
suffixsha="${sha#$shortsha}"
breachcount="$(curl -s https://api.pwnedpasswords.com/range/$shortsha | grep -i $suffixsha | cut -d':' -f2)"
@codehearts
codehearts / pyglet_rectangle.py
Created November 18, 2018 08:08
Function to draw a rectangle using Pyglet
import pyglet
def draw_rect(x, y, width, height):
pyglet.graphics.draw(4, pyglet.gl.GL_QUADS,
('v2f', [x, y, x + width, y, x + width, y + height, x, y + height]))
class Moon(object):
"""Graphical moon object"""
PHASES = ('new', 'waxing-crescent', 'first-quarter', 'waxing-gibbous',
'full', 'waning-gibbous', 'third-quarter', 'waning-crescent')
def __init__(self, x, y):
"""Creates a new moon at the coordinates"""
self._x, self._y = x, y
cmd2svg() {
name="$1"
shift
dest="$2"
shift
termtosvg -s "$dest" -g 80x20 -t gjm8 -c "$*"
mv "$dest"/termtosvg_00000.svg /mnt/"$name"
}
❄️✊🏾✊🏿🌹🌹🌹🌹🌹🌹🌹
🌸❄️✊🏾✊🏿🔥🔥🔥🔥🔥🔥
☁️🌸❄️✊🏾✊🏿☘️☘️☘️☘️☘️
🌸❄️✊🏾✊🏿💧💧💧💧💧💧
❄️✊🏾✊🏿☂️☂️☂️☂️☂️☂️☂️
╔═══*.·:·.☽✧ ✦ ✧☾.·:·.*═══╗
 black lives matter
╚═══*.·:·.☽✧ ✦ ✧☾.·:·.*═══╝