Skip to content

Instantly share code, notes, and snippets.

View shrmnk's full-sized avatar
🏕️
working from home

Sherman K shrmnk

🏕️
working from home
View GitHub Profile
@shrmnk
shrmnk / README.md
Created July 6, 2023 17:55
Setting up Cloudflared DoH client on Ubuntu Server with resolved
  1. Install cloudflared
  2. Create /etc/systemd.system/cloudflared-proxy-dns.service with contents:
[Unit]
Description=DNS over HTTPS (DoH) proxy client
Wants=network-online.target nss-lookup.target
Before=nss-lookup.target

[Service]
AmbientCapabilities=CAP_NET_BIND_SERVICE
@shrmnk
shrmnk / README.md
Created July 6, 2023 16:36
Running multiple cloudflared tunnels with token

Running multiple Cloudflare Tunnel services

This is a simple guide to setting up multiple cloudflared services (via systemctl). Useful if you have to run tunnels authenticated by different accounts and want to let each account handle their tunneling configurations via the Dashboard/UI.

  1. (optional, so its easy to clone the service definition file) Setup your first tunnel using the standard sudo cloudflared service install <token> command
  2. cd into the folder containing the cloudflared.service definition (usually /etc/systemd/system or /usr/lib/systemd/system
  3. Duplicate the existing cloudflared.service into another file with a unique name e.g. sudo cp cloudflared.service cloudflared-b.service
  4. Open up your new service cloudflared-b.service in your favorite text editor
  5. Change the token within the ExecStart= line to match your second tunnel
  6. Change the service Description= to match your service filename
@shrmnk
shrmnk / ip_or_prefix
Created October 21, 2019 03:27
Regex validating IP address OR prefix list
^((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))|pl-[0-9a-z]{8})$
@shrmnk
shrmnk / libreadline_7_not_found.sh
Created January 17, 2019 06:14
Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
ln -s /usr/local/opt/readline/lib/libreadline.8.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
@shrmnk
shrmnk / settings.tix
Created November 21, 2018 21:45
GoodSync Server Default Content of settings.tix on Linux
<ServerSettings>
LogLevel = 4
ConsoleLevel = 0
RetainLogDays = 10
LogFolder = "/root/.goodsync/server"
LogPrefix = ""
AccessLogFolder = ""
AccessLogPrefix = ""
MaxConnections = 512
PreventSleep = No
@shrmnk
shrmnk / proxy.sh
Created January 29, 2018 03:05
Running Ghost on Dokku
dokku config:get blog DOKKU_PROXY_PORT_MAP
http:80:5000 https:443:5000
@shrmnk
shrmnk / q3_checker.rb
Last active December 6, 2017 03:31
IS103 CT AY1213 Q3 Binary Tree Checker
############################################################
# AY1213 Term 2 Finals #
# Q3 Binary Tree solution checker #
# NOTE: This is a best-effort simple solution checker #
# and put together in probably the most inefficient #
# way. Sorry Prof Hady & Mok! #
############################################################
# Updated 6 Dec 17, 1115 #
# Feel free to comment/fork #
############################################################
@shrmnk
shrmnk / datepicker_input.rb
Created November 1, 2017 06:11
Simple Form Datepicker Input
class DatepickerInput < SimpleForm::Inputs::Base
def input(wrapper_options)
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
@builder.text_field(attribute_name, merged_input_options) + \
@builder.hidden_field(attribute_name, { :class => attribute_name.to_s + "-alt"})
end
end
@shrmnk
shrmnk / firmatatest.js
Last active February 24, 2016 18:24 — forked from ajfisher/firmatatest.js
Serial comms over hardware UART for Johnny-Five between Arduino and a Raspberry Pi
var firmata = require('firmata');
var repl = require('repl');
var board = new firmata.Board('/dev/ttyAMA0',function(err){
//arduino is ready to communicate
if (err) {
console.log("err:" + err);
return;
}
console.log("Firmata Firing LEDs");
@shrmnk
shrmnk / RelayTest.ino
Created February 14, 2016 07:09
Toggles a relay every 2 seconds (adjustable). Requires DFRobot LCD Shield. Up/Down changes delay by 500ms, Right resets to 2s. Select to Pause.
/*
RelayTest
Toggles a relay every 2 seconds (adjustable)
Values adjustable by the DFRobot LCD Shield's onboard buttons.
Each Up press increases the delay by 0.5s, and down does the reverse.
Right resets the delay to the default of 2s.
See RELAY_PIN and STARTING_DELAY to change configuration
modified 14 Feb 2016