Skip to content

Instantly share code, notes, and snippets.

@joshlarsen
joshlarsen / cloudSettings
Last active February 3, 2022 22:19
vscode settings
{"lastUpload":"2022-02-03T22:19:36.554Z","extensionVersion":"v3.4.3"}
@joshlarsen
joshlarsen / dns.sh
Created March 19, 2019 18:45
DNSimple dynamic IP update script
#!/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 / app.js
Created March 19, 2019 18:38
Google Cloud Functions Node.js 8 Simple Emulator
/**
* 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 / irb.rb
Created January 9, 2019 19:04
Ruby backtrace in IRB
begin
# Some exception throwing code
rescue => e
puts "Error during processing: #{$!}"
puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
end
@joshlarsen
joshlarsen / server.js
Created October 19, 2018 18:11
Simple node.js proxy with dynamic route lookups via Redis
const http = require('http');
const httpProxy = require('http-proxy');
const redis = require('redis');
// listen port
const port = 5050;
// redis client
const client = redis.createClient();