Skip to content

Instantly share code, notes, and snippets.

View gaybro8777's full-sized avatar
πŸ’­
Im not gay. I'm just getting back at my dad for not getting me an xbox

Michael Corrado gaybro8777

πŸ’­
Im not gay. I'm just getting back at my dad for not getting me an xbox
View GitHub Profile
@gaybro8777
gaybro8777 / log_deadlocks.sh
Created May 27, 2018 22:40 — forked from colinmollenhour/log_deadlocks.sh
Log Innodb Deadlocks
#!/bin/bash
dir=/root/deadlocks
[ -d $dir ] || mkdir -p $dir
cd $dir || { echo "Could not cd to $dir"; exit 1; }
mysql -be 'show engine innodb status;' \
| sed 's/\\n/\n/g' \
| awk '/TRANSACTIONS/{flag=0}flag;/LATEST DETECTED DEADLOCK/{flag=1}' \
> latest.txt
@gaybro8777
gaybro8777 / uglifyjs-benchmark-results.md
Created May 24, 2018 10:39 — forked from FGRibreau/uglifyjs-benchmark-results.md
Real-world benchmark results of UglifyJS v1 vs UglifyJS v2

Compressing 4 bundles with Pound (npm view pound) with JavaScript production code from https://redsmin.com


UglifyJS v1

  • times: 37720ms 36971ms
  • output size: 533Ko, 479Ko, 120Ko, 538Ko
@gaybro8777
gaybro8777 / hash_range.js
Created May 24, 2018 10:38 — forked from FGRibreau/hash_range.js
My yesterday night 1 hour code rush: JavaScript Hash with Range-based keys
/**
* September 20 night: 1 hour code rush
* @FGRibreau
*
* Requirements
* ------------
* The aim of this code rush is to enable developers to define a "range hash map"
* in a very expressive way (without if/then/else).
*
* Data-set
@gaybro8777
gaybro8777 / underscore_template_err.js
Created May 24, 2018 10:37 — forked from FGRibreau/underscore_template_err.js
Add the following code just after UnderscoreJS declaration to find where _.template calls are run against empty templates.
/**
* Add the following code just after UnderscoreJS declaration to find
* where _.template calls are run against empty templates.
*/
(function(old){
_.template = function(str, data) {
if(!str){
console.error("Could not load template", new Error().stack);
$('#el').AttributeObserver(attr, callback, [delay]);
@gaybro8777
gaybro8777 / pid.js
Created May 24, 2018 01:43 — forked from FGRibreau/pid.js
Simple snippet for cross-platform .pid management in NodeJS. I use it for managing NodeJS apps with supervisord and monit
//
// Usage: require('./pid')("myapp");
//
var fs = require('fs');
module.exports = function(appname){
process.title = appname;
var PID_FILE = "/usr/local/var/run/"+process.title+".pid";
@howCodeORG
howCodeORG / algo.py
Created May 12, 2018 01:35
howCode's Simple Genetic Algorithm in Python
import random
population = 200
generations = 0
mutation = 0.01
alphabet = "abcdefghijklmnopqrstuvwxyz! "
target = "subscribe to howcode!"
output = ""
data = []
@gaybro8777
gaybro8777 / ttf2woff2.md
Created April 4, 2018 19:14 — forked from sergejmueller/ttf2woff2.md
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2
{ '@DTNmX+4SjsgZ7xyDh5xxmNtFqa6pWi5Qtw7cE8aR9TQ=.ed25519': 'wx.larpa.net:8008:@DTNmX+4SjsgZ7xyDh5xxmNtFqa6pWi5Qtw7cE8aR9TQ=.ed25519',
'@D0GsAaMyt96Ze3q1YiiuzWhPkyou2fVTUgw8Xr+G7Jo=.ed25519': '9ithub.com:8008:@D0GsAaMyt96Ze3q1YiiuzWhPkyou2fVTUgw8Xr+G7Jo=.ed25519',
'@dBQlwh9Gtr3i5YMOGtIOKtGNVepeu+nyb6KGl1vtOcM=.ed25519': 'sp9.solarpunk.dk:8008:@dBQlwh9Gtr3i5YMOGtIOKtGNVepeu+nyb6KGl1vtOcM=.ed25519',
'@SP4xNZmDsOuRrjDS6NCcmr3xoieXQOMPBQ4TkUHSJ2M=.ed25519': 'sp4.solarpunk.dk:8008:@SP4xNZmDsOuRrjDS6NCcmr3xoieXQOMPBQ4TkUHSJ2M=.ed25519',
'@BzMp3eRNjPUonwRd/0loT3KaRKIMFx7ZOZQE1F+XDug=.ed25519': 'sbot.ktorn.com:8008:@BzMp3eRNjPUonwRd/0loT3KaRKIMFx7ZOZQE1F+XDug=.ed25519',
'@eM4e8pmRiZpeCBitqp6vq3lT8EwC5UjjKuajHbpWnNI=.ed25519': '198.199.97.80:8008:@eM4e8pmRiZpeCBitqp6vq3lT8EwC5UjjKuajHbpWnNI=.ed25519',
'@YXquIbh1OqCCdMuqCO4tSJuYR7RL811CTuu59n7G0pk=.ed25519': 'post.tableflip.io:8008:@YXquIbh1OqCCdMuqCO4tSJuYR7RL811CTuu59n7G0pk=.ed25519',
'@nSCVHJ5OSajcynWgo3Xh0bChZN3e4oV1ooIuFWdxrmg=.ed25519': 'hub.devcontr