Skip to content

Instantly share code, notes, and snippets.

View cookiengineer's full-sized avatar
💭
Hacking the Gibson ...

Cookie Engineer cookiengineer

💭
Hacking the Gibson ...
View GitHub Profile
#!/usr/bin/perl
######################################################################
#
# File : split_bootimg.pl
# Author(s) : William Enck <[email protected]>
# Description : Split appart an Android boot image created
# with mkbootimg. The format can be found in
# android-src/system/core/mkbootimg/bootimg.h
#
# Thanks to alansj on xda-developers.com for
@cookiengineer
cookiengineer / apt-pac.sh
Last active September 11, 2023 20:06
APT-PAC - pacman with APT syntax
#!/bin/bash
# Save this file as /usr/bin/apt-pac and chmod +x it.
case "$1" in
autoremove)
pacman -Rns $(pacman -Qdtq);
;;
@cookiengineer
cookiengineer / refactor_po.js
Created November 7, 2016 10:54
gnome-shell/refactor_po.js Helper script
#!/usr/bin/env node
/*
* XXX: This helper script is for usage with the GNOME Shell fork at
* https://github.com/cookiengineer/gnome-shell
*
* It will refactor "out" all PO translation sections that start with
* any of the filtered entries below.
*/
@cookiengineer
cookiengineer / rot32.js
Created December 5, 2016 01:07
ES6 Awesomeness
const _DICTIONARY = new Array(96).fill('').map((a,v) => String.fromCharCode(32 + v));
const _encode_rot32 = function(string) {
return Array.prototype.map.call(string, val => _DICTIONARY[(32 + _DICTIONARY.indexOf(val)) % _DICTIONARY.length]).join('');
};
const _decode_rot32 = function(string) {
return Array.prototype.map.call(string, val => _DICTIONARY[(_DICTIONARY.indexOf(val) - 32 + _DICTIONARY.length) % _DICTIONARY.length]).join('');
};
@cookiengineer
cookiengineer / Brain.js
Last active January 4, 2017 17:22
Quick 'n dirty Backpropagated Neural Network implementation
const _LEARNING_RATE = 0.3;
const _LEARNING_MOMENTUM = 0.9;
const _random = function() {
return (Math.random() * 2) - 1;
};
const Brain = function(network) {
@cookiengineer
cookiengineer / Renderer.js
Created March 14, 2017 15:44
Canvas Renderer with dirty callstack integration
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 / StandardFirmataPlus.ino
Created May 9, 2017 13:30
Standard Firmata Plus firmware backup for Johnny Five
/*
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 / console-polyfill.js
Last active August 25, 2021 15:06
A better console API for node.js, with support for all data types and pretty-printing using shell color codes
(function() {
let _std_out = '';
let _std_err = '';
/*
* HELPERS
@cookiengineer
cookiengineer / etkey.sh
Created August 23, 2018 14:13
Enemy Territory: Key Generator
#!/bin/bash
thisscript=$(readlink -f $0);
mygoto=`dirname $thisscript`;
myhome=$HOME;
FLOOR=99999;
export TZ="GMT";
@cookiengineer
cookiengineer / list.md
Created January 30, 2021 21:37 — forked from ih2502mk/list.md
Quantopian Lectures Saved