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
View split_bootimg.pl
#!/usr/bin/perl
######################################################################
#
# File : split_bootimg.pl
# Author(s) : William Enck <enck@cse.psu.edu>
# 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 / refactor_po.js
Created Nov 7, 2016
gnome-shell/refactor_po.js Helper script
View refactor_po.js
#!/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.
*/
View rot32.js
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 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) {
@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 / 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 / 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 / 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 / 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 / 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";
You can’t perform that action at this time.