Skip to content

Instantly share code, notes, and snippets.

View chamun's full-sized avatar

Rodrigo Chamun chamun

View GitHub Profile
@chamun
chamun / bongo-cat-baby-shark.js
Created October 23, 2020 18:26
Bongo Cat plays Baby Shark
// https://bongo.cat/
// Copy and paste in the browser console.
const playNote = key => {
const downEvent = new KeyboardEvent('keydown', { 'key': key } )
const upEvent = new KeyboardEvent('keyup', { 'key': key } )
document.dispatchEvent(downEvent);
setTimeout(() => document.dispatchEvent(upEvent), 100);
}
@chamun
chamun / koch_snowflake.pde
Created August 16, 2016 16:20
My implementation of a Koch Snowflake plot using Processing
void setup() {
size(600, 600);
}
void draw() {
background(#ffffff);
int steps = 4;
PVector a = new PVector(100, 200);
PVector b = new PVector(500, 200);
PVector c = PVector.add(a, PVector.sub(b, a).rotate(radians(60)));
@chamun
chamun / jokenpo.rb
Last active October 2, 2015 22:09
A simple implementation of a Jokenpo server
# Author: Rodrigo Chamun
# How to run:
# Server: ruby jokenpo.rb
# Players: $ nc server_address 6666 - 2>/dev/null
require 'socket'
require 'forwardable'
class Move
@chamun
chamun / tmux-with-grunt-watch
Last active August 29, 2015 14:26
tmux setup with a status panel running `grunt watch`
#!/bin/bash
SESSION=session-name
# Create a new tmux session named $SESSION with a window named code
tmux new-session -d -n code -s $SESSION
# Create a 5 lines tall panel in $SESSION and run `grunt watch`
tmux split-window -d -l 5 -t $SESSION:code 'grunt watch'
# Attach $SESSION to the terminal