Skip to content

Instantly share code, notes, and snippets.

@latenssi
latenssi / adding-tailscale-to-edgerouter.md
Created February 23, 2022 10:43 — forked from lg/adding-tailscale-to-edgerouter.md
Add tailscale to an EdgeRouter and surviving system upgrade

Adding tailscale to an EdgeRouter (and surviving system upgrades)

I suggest you run sudo bash on all of these so you're the root user.

Installing

  1. Download tailscale and put the files in /config/. Find the latest stable or unstable version for your EdgeRouter's processor (ex. ER4 is mips and ERX is mipself)
sudo bash    # if you havent already
@latenssi
latenssi / boto3-add-cache-control.py
Last active January 15, 2021 11:16
Add a CacheControl setting to S3 compatible endpoints
from boto3 import session
ACCESS_ID = "XXX"
SECRET_KEY = "XXX"
REGION = "XXX"
BUCKET = "XXX"
session = session.Session()
client = session.client('s3',
region_name=REGION,
@latenssi
latenssi / container.sh
Created April 10, 2019 07:28
Healthchecks
#!/bin/bash
SERVICE_NAME=
FAIL_URL=
OK_URL=
if [ -z `docker ps -q --no-trunc | grep $(docker-compose ps -q $SERVICE_NAME)` ];
then curl -fsS --retry 3 $FAIL_URL;
else curl -fsS --retry 3 $OK_URL;
fi
@latenssi
latenssi / hc-cmd.py
Created April 10, 2019 06:54
Generate healthchecks
from __future__ import print_function
import os
import json
try:
from urllib.request import Request, urlopen # Python 3
except ImportError:
from urllib2 import Request, urlopen # Python 2
const IPFS = require("ipfs");
const OrbitDB = require("orbit-db");
const ipfs = new IPFS({
repo: "./ipfs",
EXPERIMENTAL: {
pubsub: true
}
});
@latenssi
latenssi / ecr-helper.md
Last active December 4, 2018 08:59
AWS ECR helper
  1. Clone the git repository https://github.com/awslabs/amazon-ecr-credential-helper.git

  2. cd to the cloned folder "amazon-ecr-credential-helper"

  3. Run the command on terminal "make docker" (it will create the binary "./bin/local/docker-credential-ecr-login")

  4. Copy this binary to /usr/bin with the command " sudo cp ./bin/local/docker-credential-ecr-login /usr/bin/docker-credential-ecr-login

  5. Create or modify the docker config.json file available at /.docker/config.json with the below content

@latenssi
latenssi / edit_file.sh
Last active August 16, 2018 10:33
Rmate remote editing
rmate test.txt
@latenssi
latenssi / timestamp.txt
Created June 6, 2017 05:55
Linux timestamps
date --date='TZ="Europe/London" 12:00 tomorrow' +%s%N | cut -b1-13
@latenssi
latenssi / hyphencaseToCamelcase.js
Last active April 13, 2017 06:50
Hyphencase to Camelcase
const hyphencaseToCamelcase = s => s.replace(/(\-\w)/g, m => m[1].toUpperCase());

Keybase proof

I hereby claim:

  • I am latenssi on github.
  • I am laurijunkkari (https://keybase.io/laurijunkkari) on keybase.
  • I have a public key ASA-JQHVrnZHuW7j8BoGR47j3luWLUvKepDIpu09KBk8ygo

To claim this, I am signing this object: