Skip to content

Instantly share code, notes, and snippets.

View koopa's full-sized avatar

kon koopa

View GitHub Profile
@koopa
koopa / advent.of.code.js
Last active December 7, 2021 08:49
advent 2021
//1 - I
document.body.textContent.split("\n").map(Number).reduce(
(acc, it) => it > acc[0]
? [it, acc[1]+1] $
: [it, acc[1]],
[9999, 0])[1]
//1 - II
(nums = document.body.textContent.split("\n").map(Number)).splice(3).reduce(
(acc, it) =>
@koopa
koopa / mrpga.js
Created August 22, 2019 21:36
render black font on white background readable in most browsers' PDF viewers
document.body.style.filter='invert(96%)'
@koopa
koopa / audio-gain-eq-adjust.js
Last active January 24, 2020 13:49
unnormalized / quiet video fix
let nodes = {}
const audioCtx = new AudioContext()
const getNodes = ()=>{
if(nodes.eq) return nodes
const videoElement = document.querySelector("video")
const source = audioCtx.createMediaElementSource(videoElement)
nodes['gain'] = audioCtx.createGain()
nodes['eq'] = audioCtx.createBiquadFilter();
nodes['eq'].type = "bandpass";
source.connect(nodes['gain'])
import Ember from 'ember';
import { A } from '@ember/array';
import { sum, mapBy } from '@ember/object/computed';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
radiators: A([]),
radiations: mapBy('radiators', 'radiation'),
tot: sum('radiations'),
actions: {
addRadiator(){
@koopa
koopa / dcize.sh
Created August 10, 2012 07:47
b256 encoded bash script to convert b256 bytestreams to decimal base (i.e. the opposite of ${someNumber}P | dc)
echo -n 854093087332512253435501864310183940832507192295408000409585604916211200592875203742019876251460711432696057019874315744931750517095889492131800997746702733165802618078266538681934134707734651380433757630496880967089210126694690159204434191529802990945865852403285492423032065203717560182632592460338054710209764656288796916394348044515731959664426101097102547777847516813482416752677237712567111866117965501855654977688650120195396741643253571299579569997393719893460802728847979024867547108671378728815246433542993568911646314269224796266872842346367340309188722360077652496830559P | dc | tr '_%?' '\n *'