AWS Systems Management (SSM) Agent enables you to remotely monitor, update, configure, and SSH into a machine from anywhere, without needing to know it's IP address. Very handy when using Raspberry Pi's across networks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# The usual | |
sudo apt update -y | |
sudo apt upgrade -y | |
sudo apt autoremove -y | |
# Install some nice packages | |
sudo apt install gedit nano | |
# Install nodejs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const cassandra = require('cassandra-driver'); | |
const async = require('async'); | |
const assert = require('assert'); | |
var tls = require('tls'); | |
var fs = require('fs'); | |
var config = require('./config'); | |
var ssl_option = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cayenne Low-power Payload Library | |
* | |
* @author Pasakorn Tiwatthanont | |
* @email ptiwatthanont@gmail.com | |
* | |
* @link https://htmlcheatsheet.com/js/ | |
*/ | |
// console.log('Node.js version: ' + process.version) | |
format = require('string-format') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Update Jan 2024 | |
# Deploying Cloud Functions is much simpler than it was 6 years ago. | |
# I'm leaving the gist in it's original 2018 state for now, | |
# but skip the the recent comments below for a simpler solution. | |
variables: | |
GCP_ZONE: us-central1-a | |
stages: | |
- npm-install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node.js get keypress | |
var stdin = process.stdin; | |
// without this, we would only get streams once enter is pressed | |
//stdin.setRawMode( true ); | |
// resume stdin in the parent process (node app won't quit all by itself | |
// unless an error or process.exit() happens) | |
stdin.resume(); | |
// i don't want binary, do you? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mqtt = require('mqtt'); //https://www.npmjs.com/package/mqtt | |
var Topic = '#'; //subscribe to all topics | |
var Broker_URL = 'mqtt://192.168.1.123'; | |
var Database_URL = '192.168.1.123'; | |
var options = { | |
clientId: 'MyMQTT', | |
port: 1883, | |
//username: 'mqtt_user', | |
//password: 'mqtt_password', |
export AWS_DEFAULT_REGION=ap-northeast-1
aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | \
awk '{print $2}' | grep -v ^$ | while read x; do echo "deleting $x" ; aws logs delete-log-group --log-group-name $x; done
(based on https://lists.ubuntu.com/archives/snapcraft/2016-October/001382.html and https://docs.docker.com/engine/getstarted/)
Search for the snap:
$ snap find docker
Name Version Developer Notes Summary
docker 1.11.2-9 canonical - The docker app deployment mechanism
j2 0.3.1-0 cmars - Command-line interface to Jinja2 for templating in shell scripts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net'); | |
// creates the server | |
var server = net.createServer(); | |
//emitted when server closes ...not emitted until all connections closes. | |
server.on('close',function(){ | |
console.log('Server closed !'); | |
}); |
NewerOlder