Skip to content

Instantly share code, notes, and snippets.

@noahcoad
noahcoad / gmail.ahk
Created February 13, 2013 19:37
3 handy global hotkeys for composing email
; update as needed
chrome := userprofile "\Local Settings\Application Data\Google\Chrome\Application\chrome.exe"
iexplorer := "C:\Program Files (x86)\Internet Explorer\iexplore.exe"
; Open Gmail Inbox
#^e:: OpenChromeUrl("http://mail.google.com/mail")
; Compose Gamil Email
#^c:: OpenChromeUrl("https://mail.google.com/mail/?view=cm&fs=1&tf=1")
// A simple hello world microservice
// Click "Deploy Service" to deploy this code
// Service will respond to HTTP requests with a string
module['exports'] = function helloWorld (hook) {
// hook.req is a Node.js http.IncomingMessage
var host = hook.req.host;
// hook.res is a Node.js httpServer.ServerResponse
// Respond to the request with a simple string
hook.res.end(host + ' says, "Hello there world!"');
};
@noahcoad
noahcoad / manpow-homeland-hubspot-proxy-hookio.js
Last active August 3, 2016 17:28
ManPow Homeland Hubspot Proxy hook.io
module['exports'] = function echoHttp (hook) {
var request = require('request');
var mongodb = require('mongodb');
paths = {
'requestbin': hook.env['manpow-homeland-hubspot-proxy-requestbin-url'],
'moneybug': "http://homeland2.nwaoftexas.com/hubspot/money-bug-hook",
'nwa': 'https://homeland.nwaoftexas.com/nwa/import/investor-lead-data',
'testnwa': 'http://heartland.nwaoftexas.com/money-bug/collect-newwestern',
'testmb': "http://heartland.nwaoftexas.com/money-bug/collect" }
@noahcoad
noahcoad / yaml2json.py
Last active December 27, 2019 22:46
Python to Convert yaml to json
# convert yaml to json
# pip3 install pyyaml
# http://pyyaml.org/wiki/PyYAMLDocumentation
# py3 yaml2json.py < ~/code/manpow/homeland/heartland/puphpet/config.yaml
# gist https://gist.github.com/noahcoad/51934724e0896184a2340217b383af73
import yaml, json, sys
sys.stdout.write(json.dumps(yaml.load(sys.stdin), sort_keys=True, indent=2))
@noahcoad
noahcoad / json2yaml.py
Last active November 3, 2023 11:40
Python to convert json to yaml
#!/usr/bin/env python3
# convert json to yaml
# http://pyyaml.org/wiki/PyYAMLDocumentation
# python3 json2yaml.py < ~/code/manpow/moneybug/mbuploader/support/offices.json
# gist https://gist.github.com/noahcoad/46909253a5891af3699580b8f17baba8
import yaml, json, sys
sys.stdout.write(yaml.dump(json.load(sys.stdin)))
@noahcoad
noahcoad / get_serial.py
Created June 22, 2018 18:59
Get the hardware serial number for Raspberry Pi or Mac in Python 3.6
import platform, re, subprocess, os.path, logging;
log = logging.getLogger('simple_example')
log.setLevel(logging.INFO)
# get local system serial identifier
# tested for Raspberry Pi and Mac OSX
def get_serial():
log.info("getting serial number")
ptn = None
@noahcoad
noahcoad / color_scheme_additions.xml
Last active October 11, 2018 02:41
Custom Sublime Text Text File Coloring
<dict>
<key>name</key>
<string>Noah Text: header</string>
<key>scope</key>
<string>plaintxt.header</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#a6e22e</string>
</dict>
@noahcoad
noahcoad / readme.md
Last active March 2, 2024 22:02
Code Minecraft with Python on Mac OSX

Code Minecraft with Python on Mac OSX

Here's a step-by-step to get started scripting Minecraft with Python on Mac OSX

@noahcoad
noahcoad / upgrade-osx-mac-bash.md
Last active May 7, 2019 15:36
Upgrade bash on OSX

Upgrade bash on OSX

Due to GPL limitations, OSX ships with bash v3.2.57. As of writing this the current version is bash v5.0.2. bash v4 and beyond support unicode characters, and much more.

Check current bash version with:

echo $BASH_VERSION

To upgrade use Homebrew

@noahcoad
noahcoad / install-aws-greengrass-dependencies-java-node.md
Last active May 7, 2019 15:32
Install java and nodejs for AWS Greengrass

How to install the java and nodejs dependencies for AWS Greengrass

Greengrass v1.7 specifically supports Java 8 and NodeJS 6.10, and it requires the binaries be in the PATH and a specific file name.

On an Amazon Linux 2 AMI EC2 Instance

# install java
sudo yum install -y java-1.8.0-openjdk