Skip to content

Instantly share code, notes, and snippets.

View lbr88's full-sized avatar

Lars Bo Rasmussen lbr88

  • AiO-IT
  • Taastrup, Denmark
View GitHub Profile
@lbr88
lbr88 / export-all-yaml.sh
Created March 9, 2023 15:23
Export "all" resources from kubernetes to yaml. Requires kubectl plugin neat
#!/bin/bash
kubectl get -A -o custom-columns="kind":.kind,"name":.metadata.name,"namespace":.metadata.namespace pvc,configmap,serviceaccount,secret,ingress,service,deployment,statefulset,hpa,job,cronjob,replicaset --no-headers | while read kind name namespace
do
#echo $kind
#echo $namespace
#echo $name
mkdir -p "${namespace}"
echo "${namespace}:${kind}/${name}"
kubectl get -o=yaml -n "$namespace" "${kind}/${name}" |kubectl neat > "${namespace}/${kind}-${name}.yaml"
done
import clipboard
import re
raw = clipboard.paste()
p = re.compile('.*\/\/([0-9]+)>(.*) » (.*) - .*$')
output = ""
for l in raw.splitlines():
m = p.match(l)
if m != None:
output += "{0} {1} --> {2}\n".format(m.group(1),m.group(2),m.group(3))
if output != "":
@lbr88
lbr88 / rundeck_executions_cleanup.sh
Created July 27, 2018 08:40 — forked from shamil/rundeck_executions_cleanup.sh
Rundeck executions cleanup
#!/bin/bash
# see related issue: https://github.com/rundeck/rundeck/issues/357
# import vars
source ~/.rd/rd.conf
# make sure rd & jq commands are in the PATH
which -- rd jq >/dev/null || exit 1
del_executions() {
local project=$1
while true; do
@lbr88
lbr88 / timeout.php
Created March 29, 2018 17:30 — forked from avalanche123/timeout.php
timeouts in php
<?php
class TimeoutException extends RuntimeException {}
class Timeout
{
private $active;
public function set($seconds)
{
#/etc/systemd/system/mqtt-2-influxdb.service
[Unit]
Description=MQTT to Influxdb bridge
After=network.target
[Service]
Type=simple
User=lrasmussen
WorkingDirectory=/home/lrasmussen/mqtt-2-influxdb
ExecStart=/usr/bin/nodejs --use_strict ./app.js
# -- coding: utf-8 --
#
from sopel import module
@module.require_owner
@module.commands("nick")
def changeNick(bot,trigger):
newnick = trigger.group(2)
bot.nickname = newnick
bot.write(("NICK",), newnick)

Keybase proof

I hereby claim:

  • I am lbr88 on github.
  • I am pavr (https://keybase.io/pavr) on keybase.
  • I have a public key whose fingerprint is 5D6E B6D7 9FC4 B315 A9F2 AE17 93F7 97D2 4E05 5F87

To claim this, I am signing this object:

@lbr88
lbr88 / zfsfilecount.sh
Created September 11, 2016 20:32
count zfs files
zpoolname=$1;
zfs list |grep $zpoolname/ |while read line; do mount=$(echo $line |cut -d" " -f5); echo $mount:; find $mount -type f| wc -l; done