Skip to content

Instantly share code, notes, and snippets.

View beatobongco's full-sized avatar

Beato Bongco beatobongco

View GitHub Profile
@beatobongco
beatobongco / jsbin.vetopamo.css
Last active August 29, 2015 13:57
Game of Life interpretation in Javascript using radio buttons
.row{ height:10px; margin:5px;}
.innerSquare{
float:left;
height:5px;
width:5px;
margin:5px;
}
call("9175255976", { "onAnswer": lambda event : say("Hello Marte")
})
@beatobongco
beatobongco / resistance_band.py
Last active August 29, 2015 14:06
Resistance Band Calculator
import itertools
#config
thepool = [10,20,30,40,60,100]
HOWMANY = 5
# get all possible (mynum) piece combinations from a set of (stuff). Can repeat pieces
def get_combos(stuff, mynum):
returned_list = []
for subset in itertools.combinations_with_replacement(stuff, mynum):
@beatobongco
beatobongco / queue.js
Created April 29, 2015 10:45
Useful for queueing animations
function Queue() {
this._sleep = 0
this.add = function(f, sleep) {
this._sleep += sleep
setTimeout(function(){
f()
}, this._sleep)
}
}
@beatobongco
beatobongco / bgc.css
Last active August 29, 2015 14:22
BGC CSS
.test {
width: 100%;
}
// 1. Enter sheet name where data is to be written below
var SHEET_NAME = "Sheet1";
// 2. Run > setup
//
// 3. Publish > Deploy as web app
// - enter Project Version name and click 'Save New Version'
// - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously)
//
// 4. Copy the 'Current web app URL' and post this in your form/script action
var cool = null
$.get('https://beatobongco.com/book-highlights/book/shoe-dog', function(a) {
var el = document.createElement('html')
el.innerHTML = a
cool = el
})
$('#raw-notes', cool).text() // gets contentes of div with id raw-notes
@beatobongco
beatobongco / dataset_splitter.py
Created September 16, 2018 14:00
Split datasets
import shutil
import random
from pathlib import Path
from typing import List
def dataset_splitter(output_dir: str = 'output', classes: List[str] = [], num_train=0, num_validation=0):
"""In the current directory, take files of a class and randomly copy a certain number of training examples
and validation examples into a new output directory.
@beatobongco
beatobongco / bq.sql
Last active March 19, 2019 07:50
BQ puzzles
-- get hours on a project, 0 is no hours
SELECT
name,
ifnull(SUM(w.hours),
0) AS hours
FROM (
SELECT
DISTINCT(name),
id,
0 AS hours
@beatobongco
beatobongco / fastai_workshop_1.ipynb
Created April 9, 2019 04:16
FastAI_Workshop_1.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.