Skip to content

Instantly share code, notes, and snippets.

View kadrach's full-sized avatar

Niko Eckerskorn kadrach

  • Amazon Web Services
  • Sydney, Australia
View GitHub Profile
@kubosuke
kubosuke / delete-stale-metrics-from-pushgateway.py
Last active September 9, 2024 05:24
Delete stale metrics from pushgateway
from datetime import datetime, timedelta
import os
import requests
from prometheus_client.parser import text_string_to_metric_families
PUSHGATEWAY_METRICS_URL = "https://xxx.com/metrics"
PUSH_TIME_METRICS_NAME = "push_time_seconds"
@lancethomps
lancethomps / close_notifications_applescript.js
Last active October 31, 2024 15:09
AppleScript to close all notifications on macOS Big Sur, Monterey, and Ventura
function run(input, parameters) {
const appNames = [];
const skipAppNames = [];
const verbose = true;
const scriptName = "close_notifications_applescript";
const CLEAR_ALL_ACTION = "Clear All";
const CLEAR_ALL_ACTION_TOP = "Clear";
@studds
studds / aws-step-function.json
Last active December 20, 2022 09:05
JSON Schema for AWS Step Functions (derived from https://github.com/airware/asl-validator)
{
"$schema": "http://json-schema.org/draft-07/schema",
"definitions": {
"state-machine": {
"type": "object",
"properties": {
"Comment": {
"type": "string"
},
"StartAt": {
@skrajewski
skrajewski / backup.sh
Last active December 19, 2023 14:54
Automate your macOS backup to Backblaze B2 using Restic and launchd.
#!/bin/bash
PID_FILE=~/.restic_backup.pid
TIMESTAMP_FILE=~/.restic_backup_timestamp
if [ -f "$PID_FILE" ]; then
if ps -p $(cat $PID_FILE) > /dev/null; then
echo $(date +"%Y-%m-%d %T") "File $PID_FILE exist. Probably backup is already in progress."
exit 1
else
@thiagoghisi
thiagoghisi / bluetooth-restart.sh
Created July 7, 2019 23:56
Script for Mac OSX to Restart Bluetooth service & Reconnect all recently paired devices
#!/bin/bash
echo "Restarting bluetooth service..."
blueutil -p 0 && sleep 1 && blueutil -p 1
echo "Waiting bluetooth service to be restored..."
until blueutil -p | grep "1" >/dev/null; do sleep 1; done
echo "Searching for devices not connected..."
devices=($(blueutil --paired | grep "not connected" | awk -F '[ ,]' '{print $2}'))
@ian-p-cooke
ian-p-cooke / add_wsl_exclusions.ps1
Last active June 30, 2024 05:27
powershell script to add WSL exclusions
$win_user = "ipc"
$linux_user = "ipc"
$package = "CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc"
$base_path = "C:\Users\" + $win_user + "\AppData\Local\Packages\" + $package + "\LocalState\rootfs"
$dirs = @("\bin", "\sbin", "\usr\bin", "\usr\sbin", "\home\" + $linux_user + "\.cargo\bin")
$dirs | ForEach { Add-MpPreference -ExclusionProcess ($base_path + $_ + "\*") }
Add-MpPreference -ExclusionPath $base_path
@sileht
sileht / tmux-sixel-2.5-2\~bpo9+1.patch
Last active December 5, 2022 23:12
sixel support for tmux-2.5-2\~bpo9+1
commit b4a5392a631ca08893c7b5653756bc1aa21db71b
Author: Mehdi Abaakouk <[email protected]>
Committer: Mehdi Abaakouk <[email protected]>
Date: Fri Oct 6 10:16:01 2017 (43 seconds ago)
sixel patch
Updated from https://github.com/saitoha/tmux-SIXEL
for debian strech
@SKempin
SKempin / Git Subtree basics.md
Last active October 23, 2024 04:12
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@woowa-hsw0
woowa-hsw0 / assume_role.sh
Last active January 11, 2023 11:36
Start AWS CLI Session with MFA Enabled (+Yubikey)
#!/bin/bash
set -eu
umask 0022
if [[ $# -lt 1 ]]; then
echo "Usage: $0 role_name [AWS ACCOUNT NUMBER]" >&2
exit 1
fi
@StevenACoffman
StevenACoffman / _MicroService Proxy Gateway Solutions.md
Last active July 15, 2024 05:12
Microservice Proxy/Gateway Solutions

MicroService Proxy Gateway Solutions

Kong, Traefik, Caddy, Linkerd, Fabio, Vulcand, and Netflix Zuul seem to be the most common in microservice proxy/gateway solutions. Kubernetes Ingress is often a simple Ngnix, which is difficult to separate the popularity from other things.

Github Star Trend:

Github Star History for Kong vs traefik vs fabio vs caddy vs Zuul

This is just a picture of this link from March 2, 2019

Originally, I had included some other solution