Skip to content

Instantly share code, notes, and snippets.

@bouroo
bouroo / gen_kustomization.sh
Last active February 29, 2024 21:22
k8s kustomization generate from kubectl
#!/usr/bin/env bash
#==============================================================================
# title: gen_kustomization.sh
# description: This script automatically creates kustomization deployment files from kubectl
# author: Kawin Viriyaprasopsook <kawin.v@kkumail.com>
# usage: bash gen_kustomization.sh
# notes: need `kubectl kubectl-convert kubectl-neat` packages
#==============================================================================
mkdir -p kustomization && cd kustomization
@Olshansk
Olshansk / video_to_gif.sh
Last active January 12, 2023 13:35
A handy bash function to convert a video (e.g. a screen cap) to a gif using ffmpeg in your shell
function video_to_gif {
local input_video_path="$1"
local output_gif_path="$2"
local fps="${3:-10}"
local scale="${4:-1080}"
local loop="${5:-0}"
ffmpeg -i "${input_video_path}" -vf "setpts=PTS/1,fps=${fps},scale=${scale}:-2:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop $loop "${output_gif_path}"
}
@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@zaneclaes
zaneclaes / wifi-auto-connect.sh
Created October 30, 2019 20:55
Bash script to automatically connect to open WiFi networks, upon disconnect, via nmcli
#!/bin/bash
con="${1}"
if [[ -z "$con" ]]; then
echo "Please provide an interface name as an argument."
exit 1
fi
while true; do
conns=$(nmcli con show "$con" | grep "GENERAL.STATE:" | grep "activated")
#! /usr/bin/perl
#
# Script to check for changes. It stores the original in a template file
# and (optionally) applies transformations on the output to compare with
# the updated content of a file or output from a command.
#
# Copyright 2016 <kjetil.homme@redpill-linpro.com>
# Released under the GPLv3 or later.
use strict;
@mergwyn
mergwyn / zfsbench
Last active May 2, 2024 08:28
ZFS benchmarking using fio
#!/usr/bin/env bash
set -o errexit
echo $(date):Random read
fio --filename=test --sync=1 --rw=randread --bs=4k --numjobs=1 \
--iodepth=4 --group_reporting --name=test --filesize=10G --runtime=300 && rm test
echo $(date):Random write
fio --filename=test --sync=1 --rw=randwrite --bs=4k --numjobs=1 \
@AdamNaj
AdamNaj / about.md
Last active July 13, 2022 19:50
Z Wave Graph for Home Assistant
@ciotlosm
ciotlosm / Readme.md
Last active February 5, 2024 15:04
Kiosk mode for lovelace

Kiosk mode

Installation

Add kiosk.js file with the content below to your www folder in config.

Like any other custom script, use ui-lovelace.yaml resources section to reference the kiosk.js file.

Make sure you add kiosk somewhere in your URL. You can use it in the id of your view or in the query string.

@colinodell
colinodell / patch-01-requirements.diff
Created May 22, 2017 02:48
Custom open-wave build for Home Assistant 0.45 on Docker
diff --git a/requirements_all.txt b/requirements_all.txt
index 6141e3d..2da4ce0 100644
--- a/requirements_all.txt
+++ b/requirements_all.txt
@@ -695,9 +695,6 @@ python-vlc==1.1.2
# homeassistant.components.wink
python-wink==1.2.4
-# homeassistant.components.zwave
-python_openzwave==0.4.0.31
@adrianlzt
adrianlzt / stale_sensor.py
Created February 19, 2017 22:40
Home Assistant, App Daemon module to monitor for stale sensors
import appdaemon.appapi as appapi
import homeassistant.util.dt as dt_util
#
# Notify stale sensors.
# Each minute last update of sensor is checked to see if it is higher than the configured value
#
# Args:
# sensor = sensor to monitor
# tiempo = minutes threshold to notify