Skip to content

Instantly share code, notes, and snippets.

@noahcoad
noahcoad / openSublimeProject.ahk
Last active April 16, 2018 23:20
Fixes Sublime Text 2 open project odd behavior on Windows by making sure the selected project receives focus. Will also open files in a specific project window.
;
; Opens Sublime Text 2 and makes the wanted project have focus
; If additional files are specified, they'll be opened in the specified project
; Useful for scripting, global hotkeys, command launchers, etc
;
; Example:
; openSublimeProject.ahk c:\sites\blog\blog.sublime-project c:\sites\blog\.gitignore c:\sites\blog\Gemfile
;
; Problems this script fixes:
; 1. If sublime is already open with the requested project, it creates an empty window and makes that active
@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")
@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 / 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
@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 / test_aws_iot_connection.py
Last active September 28, 2019 02:52
Tests Connection to AWS IoT Core Endpoint
#
# Tests the connection to the AWS IoT Endpoint for a user's account
# By creating an AWS IoT Thing device, certificate, keys, and policy
# Then connecting to the AWS IoT Core Endpoint with those device credentials
# Tests both port 8883 and 443
#
# Created on 2019-09-20 by Noah Coad, Amazon AWS ProServe IoT, ncoad@amazon.com
# All rights reserved.
#
# pip install boto3 AWSIoTPythonSDK
@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 / test_aws_iot_connection.py
Last active January 24, 2020 17:06
Test AWS IoT Endpoint MQTT Connection
#
# Tests the connection to the AWS IoT Endpoint for a user's account
# By creating an AWS IoT Thing device, certificate, keys, and policy
# Then connecting to the AWS IoT Core Endpoint with those device credentials
# Tests both port 8883 and 443
#
# Created on 2019-09-20 by Noah Coad, Amazon AWS ProServe IoT, ncoad@amazon.com
# All rights reserved.
#
# can also be used to create a new IoT device, or remove old ones
@noahcoad
noahcoad / lab_esp32_aws_iot_mongoose.md
Last active February 17, 2020 22:43
Lab: Connect an ESP32 to AWS IoT with MongooseOS

Lab: Connect an ESP32 to AWS IoT with MongooseOS

created 2019-12-20 by Noah Coad