Skip to content

Instantly share code, notes, and snippets.

View AshuJoshi's full-sized avatar

Ashu Joshi AshuJoshi

View GitHub Profile
@noahcoad
noahcoad / install_aws_ssm_agent_on_raspberry_pi_for_ssh_access.md
Last active June 5, 2020 02:10
Install AWS SSM Agent on Raspberry Pi for SSH Access

Install AWS SSM Agent on Raspberry Pi for SSH Access

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.

#!/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
"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 = {
@iPAS
iPAS / cayennelpp.js
Last active April 7, 2022 11:18
Cayenne Low-power Payload Decoder (javascript / node.js)
/**
* 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')
@troyharvey
troyharvey / .gitlab-ci.yml
Last active January 8, 2024 00:38
Deploy Google Cloud Functions: GitLab CI/CD Pipeline Config File
# 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
@unitycoder
unitycoder / node-presskey-console.js
Created December 21, 2017 05:18
node.js Wait For KeyPress in console
// 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?
@smching
smching / app_mqtt_mysql_completed.js
Last active April 4, 2024 09:29
Node.js application: Store messages from Mosquitto MQTT broker into SQL Database (completed)
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',
@pahud
pahud / delete_all_awslogs.sh.md
Last active October 18, 2023 09:13
delete all aws log groups

specify the region

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

only delete loggroup name starting with /aws/lambda

@come-maiz
come-maiz / docker-tests.md
Last active May 20, 2017 01:01
Docker snap testing
@sid24rane
sid24rane / net.js
Last active February 7, 2024 08:05
Simple TCP Client and Server in Node.js (Covering all useful Properties & Methods)
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 !');
});