Skip to content

Instantly share code, notes, and snippets.

💭
Hacking the Gibson ...

Cookie Engineer cookiengineer

💭
Hacking the Gibson ...
Block or report user

Report or block cookiengineer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cookiengineer
cookiengineer / apt-pac.sh
Last active Oct 24, 2019
APT-PAC - pacman with APT syntax
View apt-pac.sh
#!/bin/bash
# Save this file as /usr/bin/apt-pac and chmod +x it.
case "$1" in
autoremove)
pacman -Rns $(pacman -Qdtq);
;;
@cookiengineer
cookiengineer / console-polyfill.js
Last active Jun 21, 2019
A better console API for node.js, with support for all data types and pretty-printing using shell color codes
View console-polyfill.js
(function() {
let _std_out = '';
let _std_err = '';
/*
* HELPERS
@cookiengineer
cookiengineer / README.md
Last active Jan 24, 2019
Chromium/Gecko Bug when using instanceof operator across iframes
View README.md

instanceof operator corruption when transferring arrow functions across iframes

Test Case Architecture

The idea is to have two different html files to communicate with each other, whereas the index.html symbolizes the main program and has APIs that are accessible inside the iframe via window.parent as the origin and other CORS relevant headers are correctly set.

@cookiengineer
cookiengineer / etkey.sh
Created Aug 23, 2018
Enemy Territory: Key Generator
View etkey.sh
#!/bin/bash
thisscript=$(readlink -f $0);
mygoto=`dirname $thisscript`;
myhome=$HOME;
FLOOR=99999;
export TZ="GMT";
@cookiengineer
cookiengineer / 01-install-lycheejs.original.cast
Last active Aug 25, 2018
Shrink asciinema cast files and auto-shorten/auto-cut them accordingly.
View 01-install-lycheejs.original.cast
{"version": 2, "width": 80, "height": 24, "timestamp": 1531123077, "idle_time_limit": 2.5, "env": {"SHELL": "/bin/bash", "TERM": "xterm-256color"}, "title": "Install lychee.js"}
[0.034539, "o", "\u001b]0;cookiengineer@wuup:~\u0007\u001b]7;file://wuup/home/cookiengineer\u0007"]
[0.039619, "o", "\r\n[\u001b[32m✔\u001b[0m]─[\u001b[01;49;39mcookiengineer@wuup\u001b[0m]─[\u001b[01;49;39m/home/cookiengineer\u001b[0m]\r\n[$] "]
[1.614263, "o", "sudo bash -c \"$(curl -fsSL https://lychee.js.org/install.sh)\";\r\n"]
[1.836818, "o", "[sudo] password for cookiengineer: "]
[6.998831, "o", "\r\n"]
[7.070439, "o", " (L) \r\n\u001b[37m\u001b[42m (I) lychee.js Git/Net Installer \u001b[0m\r\n (L) \r\n"]
[7.070518, "o", " (L) This installer downloads and installs lychee.js. \r\n (L) The installation target folder is /opt/lycheejs \r\n (L) \r\n"]
[7.07055, "o", " (L) Download size is ~50MB + ~700MB + dependencies. \r\n"]
[7.070822, "o", " (L) Installation size is ~2.0GB. \r\n (L) \r\n (L) Continue (y/n)? "]
@cookiengineer
cookiengineer / StandardFirmataPlus.ino
Created May 9, 2017
Standard Firmata Plus firmware backup for Johnny Five
View StandardFirmataPlus.ino
/*
Firmata is a generic protocol for communicating with microcontrollers
from software on a host computer. It is intended to work with
any host computer software package.
To download a host software package, please click on the following link
to open the list of Firmata client libraries in your default browser.
https://github.com/firmata/arduino#firmata-client-libraries
@cookiengineer
cookiengineer / Renderer.js
Created Mar 14, 2017
Canvas Renderer with dirty callstack integration
View Renderer.js
lychee.define('Renderer').tags({
platform: 'html'
}).supports(function(lychee, global) {
/*
* XXX: typeof CanvasRenderingContext2D is:
* > function in Chrome, Firefox, IE10
* > object in Safari, Safari Mobile
*/
@cookiengineer
cookiengineer / backup.sh
Created Jan 13, 2017
Shell script to backup git repositories (and their HEAD branches) and tar.gz them
View backup.sh
#!/bin/bash
# XXX: This shell script temporarily creates the ./$orga/$repo folder structure
# XXX: This shell script persistently creates the ./$orga/$repo.tar.gz structure
ROOT_FOLDER=$(cd "$(dirname "$0")"; pwd);
_backup_repository() {
@cookiengineer
cookiengineer / fix_repos.js
Created Jan 7, 2017
Fix repos' update hooks of gitea service (which was moved around)
View fix_repos.js
#!/usr/bin/env node
// XXX: This file MUST BE in the same folder as gitea.
// if "/opt/gitea/gitea web" starts the service
// then "/opt/gitea/fix_repos.js" is this file
// and "/opt/gitea/gitea-repositories" is the repos folder (default location)
const _fs = require('fs');
const _ROOT = __dirname;
@cookiengineer
cookiengineer / Brain.js
Last active Jan 4, 2017
Quick 'n dirty Backpropagated Neural Network implementation
View Brain.js
const _LEARNING_RATE = 0.3;
const _LEARNING_MOMENTUM = 0.9;
const _random = function() {
return (Math.random() * 2) - 1;
};
const Brain = function(network) {
You can’t perform that action at this time.