Skip to content

Instantly share code, notes, and snippets.

@beebird
beebird / git-pushing-multiple.rst
Created July 25, 2022 03:40 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@beebird
beebird / prom-k8s-request-limits.md
Created March 15, 2022 10:56 — forked from max-rocket-internet/prom-k8s-request-limits.md
How to display Kubernetes request and limit in Grafana / Prometheus properly

CPU: percentage of limit

A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.

This is specific to k8s and containers that have CPU limits set.

To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:

sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
sshuttle:
pkg.installed: []
group.present:
- gid: 2024
user.present:
- fullname: sshuttle
- uid: 2024
- gid: 2024
- allow_uid_change: True
@beebird
beebird / 01nginx-tls-sni.md
Created December 29, 2021 15:24 — forked from kekru/01nginx-tls-sni.md
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@beebird
beebird / main.go
Created December 9, 2019 07:47 — forked from julz/main.go
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@beebird
beebird / generate_openvpn_config.sh
Created August 1, 2019 07:48 — forked from dmytro/generate_openvpn_config.sh
Script for OpenVPN generate client config file.
#!/bin/bash
# Easy script to create OpenVPN client configuration with the user, pre-generating user's
# RSA key and certificate.
#
# Configuration template must exist in the same directory, with only missing part: certificates.
#
# (c) Dmytro Kovalov, 2015
#
cd $(dirname ${BASH_SOURCE[0]})
@beebird
beebird / tmux.md
Created August 21, 2018 03:24 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@beebird
beebird / adb_toggle_airplane_mode.sh
Created March 31, 2018 13:10 — forked from xgouchet/adb_toggle_airplane_mode.sh
Shell script to toggle airplane mode on connected device
function adb_toggle_airplane_mode {
# Open airplane mode settings
adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS
# Key UP to focus on the first switch = toggle airplane mode, then sleep 100ms
adb shell input keyevent 19 ; sleep 0.1
# Key CENTER to toggle the first switch, then sleep 100ms
adb shell input keyevent 23 ; sleep 0.1
@beebird
beebird / patch-edid.md
Created April 7, 2016 15:33 — forked from ejdyksen/patch-edid.md
A script to fix EDID problems on external monitors in Mac OS. Source: http://embdev.net/topic/284710

patch-edid.rb

A script to fix EDID problems on external monitors in Mac OS.

  1. Connect the problem monitor.

  2. Download this script into your /System/Library/Displays/Overrides (note: this file is only writeable by root, so some commands require sudo).