Skip to content

Instantly share code, notes, and snippets.

View cb1kenobi's full-sized avatar

Chris Barber cb1kenobi

View GitHub Profile
function spawn(command, args, options) {
// Parse the arguments
const parsed = parse(command, args, options);
// Spawn the child process
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
// Hook into child process "exit" event to emit an error if the command
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
enoent.hookChildProcess(spawned, parsed);
@cb1kenobi
cb1kenobi / cb1.itermcolors
Created June 18, 2021 20:14
iTerm color scheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.20000000298023224</real>
@cb1kenobi
cb1kenobi / uid.md
Last active June 4, 2021 17:57
uid vs sudo uid
uid SUDO_UID
user 501 undefined
sudo user 0 501
root 0 undefined
sudo root 0 0
@cb1kenobi
cb1kenobi / pizza.c
Created April 27, 2021 14:14
Learning C with Jordan
#include <stdio.h>
#include <stdlib.h>
#include "pizza.h"
// Function Prototypes
int size_menu(void);
int top_menu(void);
void clear(void);
void InitStructs(struct PizzaCosts *Costs, struct StuffBought *Totals);
void Order(struct PizzaCosts *Costs, struct StuffBought *Totals);
{
"id": "com.myorg.main.dev",
"name": "MyOrg Dev",
"guid": "00000000-0000-0000-0000-000000000000",
"version": "2.8.0.prod.0726170",
"description": "undefined",
"copyright": "2017 by MyOrg",
"publisher": "MyOrg",
"url": "http://www.myorg.com",
"analytics": true,
@cb1kenobi
cb1kenobi / windows-hybrid-debug-log-server.js
Created August 27, 2018 16:13
Local debug log server for the obsolete Titanium Windows Hybrid
var logToken = 'd7a961c4d73cafbebd83a641cfef5cb2',
dgram = require('dgram'),
net = require('net'),
updServer = dgram.createSocket('udp4'),
multicastAddress = '239.6.6.6',
multicastPort = 8666,
tcpPort = 8666,
tcpServer = net.createServer(function (conn) {
console.log('App connected');
conn.on('data', function (data) {
#!/bin/sh
backupdir=/data/archive/mysql-backups
pwd=`pwd`
today=`date "+%Y-%m-%d"`
cd $backupdir
rm -f latest
rm -rf $today
mkdir $today
@cb1kenobi
cb1kenobi / porthash.js
Created November 8, 2017 23:11
Hashed port number collisions
var crypto = require('crypto');
function hash(s) {
return (parseInt(crypto.createHash('sha1').update(s || '').digest('hex'), 16) % 50000) + 10000;
}
var nums = {};
var lookup = {};
for (var i = 1; i <= 100; i++) {
@cb1kenobi
cb1kenobi / dist-test.js
Created September 1, 2017 16:37
Forces Titanium distribution builds to be deploy type test
/**
* Forces Titanium distribution builds to be deploy type test.
*
* To install, place this file in a `hooks` directory in your Titanium project directory.
*/
'use strict';
exports.id = 'com.axway.dist-test';
const vm = require('vm');
const wrap = require('module').wrap;
const code = `module.exports = {
foo: function () {
register(ctx => {
if (ctx.i === 0) {
throw new TypeError('boom');
}
if (ctx.i === 1) {