Skip to content

Instantly share code, notes, and snippets.

@drmikecrowe
drmikecrowe / info.md
Created January 24, 2018 18:55
Linux Mint 18.3 Cinnamon desktop debug info

$ cat /etc/lsb-release

DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18.3
DISTRIB_CODENAME=sylvia
DISTRIB_DESCRIPTION="Linux Mint 18.3 Sylvia"

$ ps faux | grep cinnamon

mcrowe 1811 0.0 0.0 438712 22488 ? Ssl 05:55 0:01 \_ cinnamon-session --session cinnamon
@drmikecrowe
drmikecrowe / setup.js
Created January 19, 2016 18:05
Set debug log level for MongoClient
var MongoClient = require('mongodb').MongoClient
, Logger = require('mongodb').Logger;
Logger.setLevel('debug');
set -e
set -x
sudo apt-get update
sudo apt install git python2.7 build-essential python-virtualenv python-pip python-dev libcurl4-gnutls-dev libgnutls28-dev mysql-client awscli phantomjs
# Environment variables you need to set so you don't have to edit the script below.
export DOCKER_CHANNEL=stable
# Update the apt package index.
@drmikecrowe
drmikecrowe / embed.js
Last active January 1, 2019 14:24
Embedding factualsearch.news in your website
<script>
(function() {
var cx = '011275290256739755566:cwfn9qhuqkk';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
@drmikecrowe
drmikecrowe / DisableAllMethods.js
Last active September 5, 2019 06:58
Loopback mixin to disable or expose methods
// based on https://github.com/strongloop/loopback/issues/651#issuecomment-259540469
'use strict';
const
relationMethodPrefixes = [
'prototype.__findById__',
'prototype.__destroyById__',
'prototype.__updateById__',
'prototype.__exists__',
@drmikecrowe
drmikecrowe / machine.js
Last active November 13, 2019 15:18
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@drmikecrowe
drmikecrowe / machine.js
Last active November 15, 2019 21:57
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@drmikecrowe
drmikecrowe / machine.js
Last active November 16, 2019 12:29
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@drmikecrowe
drmikecrowe / machine.js
Last active November 21, 2019 12:38
initializeMachine.js
const RETRY_INTERVAL = 2000;
const MAX_RETRIES = 3;
const initHardwareState = "initHardware";
const connectNetworkState = "connectNetwork";
const provisionState = "provision";
const retryState = "retry";
const fatalState = "fatal";
const connectedState = "connected";
@drmikecrowe
drmikecrowe / machine.js
Last active November 29, 2019 12:07
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions