Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Larsen joshlarsen

View GitHub Profile
@joshlarsen
joshlarsen / server.js
Created Oct 19, 2018
Simple node.js proxy with dynamic route lookups via Redis
View server.js
const http = require('http');
const httpProxy = require('http-proxy');
const redis = require('redis');
// listen port
const port = 5050;
// redis client
const client = redis.createClient();
@joshlarsen
joshlarsen / irb.rb
Created Jan 9, 2019
Ruby backtrace in IRB
View irb.rb
begin
# Some exception throwing code
rescue => e
puts "Error during processing: #{$!}"
puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
end
@joshlarsen
joshlarsen / app.js
Created Mar 19, 2019
Google Cloud Functions Node.js 8 Simple Emulator
View app.js
/**
* Inspiration taken from here https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/258#issuecomment-413786762
* Alternative: https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/258#issuecomment-407996126
*
* Original: https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/258#issuecomment-437080813
*/
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
@joshlarsen
joshlarsen / dns.sh
Created Mar 19, 2019
DNSimple dynamic IP update script
View dns.sh
#!/bin/bash
#
# Update DNSimple DNS record if ISP IP changes
#
# Requirements:
# existing DNS record hosted with DNSimple
# curl in $PATH
#
# run from cron
#
@joshlarsen
joshlarsen / map.js
Last active Jan 24, 2020
map AWS SDK API methods
View map.js
const AWS = require('aws-sdk')
// endpoints to query
const resources = [
'ACM',
'S3',
'EC2',
'EKS',
'IAM',
'Kinesis',
'Redshift',
@joshlarsen
joshlarsen / cloudSettings
Last active May 14, 2020
vscode settings
View cloudSettings
{"lastUpload":"2020-05-14T15:28:47.118Z","extensionVersion":"v3.4.3"}
@joshlarsen
joshlarsen / aws_config.txt
Created May 25, 2020
AWS Config Supported Resources
View aws_config.txt
AWS::ACM::Certificate
AWS::ApiGateway::RestApi
AWS::ApiGateway::Stage
AWS::ApiGatewayV2::Api
AWS::ApiGatewayV2::Stage
AWS::AutoScaling::AutoScalingGroup
AWS::AutoScaling::LaunchConfiguration
AWS::AutoScaling::ScalingPolicy
AWS::AutoScaling::ScheduledAction
AWS::CloudFormation::Stack
@joshlarsen
joshlarsen / down.sh
Created Jun 16, 2020
Monitor IPS uptime by pinging an external IP
View down.sh
#!/bin/bash
#
# Ping external IP from wired network to monitor for ISP outtage
# 2020-06-16
#
# runs on pi-hole from cron every day
#
# kill any other instances running
# name log file day_of_month_down.txt
# remove todays log file if there is one, since it will be a month old
You can’t perform that action at this time.