Skip to content

Instantly share code, notes, and snippets.

@rverchere
rverchere / k8s_vuln.sh
Last active January 5, 2022 05:08
Kubernetes pod CVE vulnerability check
#!/usr/bin/env bash
RED='\033[0;31m'
NC='\033[0m'
OLDIFS="$IFS"
IFS=$'\n'
VULN=$1
# $1 arg is the CVE number to check
if [ -z $1 ]; then
@fl64
fl64 / main.go
Created December 24, 2020 07:18
golang prometheus exporter example
package main
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"log"
"math/rand"
"net/http"
"time"
@movd
movd / watch_for_prometheus_changes.yaml
Created November 6, 2020 11:57
Hot reload Prometheus only on working config
#!/usr/bin/env bash
ls /etc/prometheus/*.yml \
| entr bash -c "promtool check config /etc/prometheus/prometheus.yml \
&& curl -X POST 'http://localhost:9090/-/reload'"
@magicdude4eva
magicdude4eva / zsh-syntax-highlighting paste performance improvement
Last active April 19, 2024 14:03
zsh-syntax-highlighting paste performance improvement
Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
@KoffeinKaio
KoffeinKaio / sync_fb_dnsmasq.sh
Created November 28, 2018 20:09
sync fb host entrys to piholes list
#!/bin/bash
FB_IP=192.168.100.1
PIHOLE_LIST=/opt/pihole/etc/fb-sync.list
#0 if pihole is standalone, 1if its running in docker
DOCKER_ACTIVE=1
DOCKER_IP=192.168.100.10
DOCKER_PORT=2376
DOCKER_PIHOLE_NAME='pi-hole'
@yteraoka
yteraoka / kvm-host-dashboard.json
Created August 20, 2017 12:30
Grafana dashboard for KVM Host
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@efrecon
efrecon / run.tpl
Last active May 3, 2024 08:39
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}
@Juul
Juul / ssh-copy-id-openwrt
Last active August 23, 2023 11:10
ssh-copy-id but for openwrt / dropbear
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Example: ${0} root@192.168.1.1"
exit 1
fi
cat ~/.ssh/id_rsa.pub | ssh ${1} "cat >> /etc/dropbear/authorized_keys && chmod 0600 /etc/dropbear/authorized_keys && chmod 0700 /etc/dropbear"
@vladimirtsyupko
vladimirtsyupko / gist:10964772
Created April 17, 2014 08:32
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master