Skip to content

Instantly share code, notes, and snippets.

View akhoury's full-sized avatar
🏠
Working from home

Aziz Khoury akhoury

🏠
Working from home
View GitHub Profile
@akhoury
akhoury / NodeBB_src_middleware_cls2.js
Created June 24, 2016 01:26
use async-hook instead of continuation-local-storage
var asyncHook = require('async-hook');
var path = require('path');
var utils = require('../../public/src/utils');
function CLS() {
var mem = {};
var self = this;
this.storage = null;
@akhoury
akhoury / cls-nodebb-testcase.js
Last active June 24, 2016 15:17
cls-nodebb-testcase
// this file is assumed to be in the root NodeBB directory
var continuationLocalStorage = require('continuation-local-storage');
var cls = continuationLocalStorage.createNamespace('test');
var async = require('async');
var path = require('path');
var nconf = require('nconf');
var path = require('path');
var nconf = require('nconf');
var async = require('async');
nconf.file({ file: path.join(__dirname, './config.json') });
var db = require('./src/database');
var S3_BASE_URL = 'https://nodebb-assests.s3-us-west-2.amazonaws.com/';
@akhoury
akhoury / promiseWhile.js
Last active August 19, 2016 20:21
promiseWhile()
function promiseWhile (condition, execute) {
return new Promise(function(resolve, reject) {
var iterate = function () {
if (condition()) {
return execute()
.then(iterate)
.catch(reject);
}
return resolve();
@akhoury
akhoury / nbb-fix-topic-viewcount.js
Created March 10, 2017 01:06
to set lithium's negative viewcount to 0
var path = require('path');
var nconf = require('nconf');
var async = require('async');
nconf.file({ file: path.join(__dirname, './config.json') });
var dbType = nconf.get('database');
var productionDbConfig = nconf.get(dbType);
nconf.set(dbType, productionDbConfig);
var path = require('path');
var nconf = require('nconf');
var async = require('async');
var url = require('url');
var _convert = require('./node_modules/nodebb-plugin-import/node_modules/bbcode-to-markdown');
nconf.file({ file: path.join(__dirname, './config.json') });
var dbType = nconf.get('database');
// tested with NodeBB v1.4.6+
var path = require('path');
var nconf = require('nconf');
var async = require('async');
var pkg = require('./package.json');
nconf.file({ file: path.join(__dirname, './config.json') });
// tested with NodeBB v1.4.6+
var path = require('path');
var url = require('url');
var nconf = require('nconf');
var async = require('async');
var pkg = require('./package.json');
nconf.file({ file: path.join(__dirname, './config.json') });
@akhoury
akhoury / migrate.sh
Created December 29, 2017 19:42 — forked from pepijnblom/migrate.sh
Upgrade MAMP to Mysql 5.7
#!/bin/sh
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.20-macos10.12-x86_64.tar.gz
tar xfvz mysql-5.7*
echo "stopping mamp"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld
echo "creating backup"
@akhoury
akhoury / Atmo-fw-update-nrf.md
Created December 2, 2018 09:27
Atmotube firmware update tutorial (nRF Toolbox)

Atmotube firmware update tutorial (nRF Toolbox)

  1. Download firmware (70.03.0A) to the internal smartphone memory or SD card;
  2. Install nRF Toolbox for BLE from Google Play;
  3. Open nRF Toolbox → go to DFU section;
  4. Select firmware file → chose "application" type with "no init packet";
  5. Select device for firmware upload (named "DfuMode");
  6. Tap "Start".