Skip to content

Instantly share code, notes, and snippets.

@rb2k
rb2k / gist:8372402
Last active April 15, 2024 19:30
A jenkins script to clean up workspaces on slaves
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
for (node in Jenkins.instance.nodes) {
blueprint:
name: Send a notification with camera snapshot when motion is detected with blocking state and URL (or lovelace view) on click, critical or not, collapse or not.
description: >
This automation blueprint creates a camera snapshot if motion is detected
and sends a notification to your phone with the picture.
Optionally you can define a binary sensor that will block the automation from running when state is ON.
For Example do not run when somebody is home (you can use the people_home template example).
Furthermore you have the option to make the notification critical or high priority and to collapse/overwrite or not.
@rb2k
rb2k / gist:3e09ff3e9d622eca52e24fc69a2c367b
Created May 21, 2023 15:22
frigate ffmpeg oom killed
[Sun May 21 09:27:27 2023] Memory cgroup out of memory: Killed process 20370 (ffmpeg) total-vm:8533984kB, anon-rss:6989448kB, file-rss:64852kB, shmem-rss:0kB, UID:0 pgtables:14260kB oom_score_adj:0
[Sun May 21 09:28:36 2023] ffmpeg invoked oom-killer: gfp_mask=0xcc0(GFP_KERNEL), order=0, oom_score_adj=0
[Sun May 21 09:28:36 2023] CPU: 1 PID: 30270 Comm: ffmpeg Not tainted 6.1.29-Unraid #1
[Sun May 21 09:28:36 2023] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./X470D4U, BIOS L4.24 02/23/2022
[Sun May 21 09:28:36 2023] Call Trace:
[Sun May 21 09:28:36 2023] <TASK>
[Sun May 21 09:28:36 2023] dump_stack_lvl+0x44/0x5c
[Sun May 21 09:28:36 2023] dump_header+0x4a/0x211
[Sun May 21 09:28:36 2023] oom_kill_process+0x80/0x111
[Sun May 21 09:28:36 2023] out_of_memory+0x3b3/0x3e5
type: horizontal-stack
title: EV Charger current
cards:
- show_name: true
show_icon: false
type: button
tap_action:
action: call-service
service: emporia_vue.set_charger_current
data:
Sources taken from https://git.fedorahosted.org/git/nss-pem.git
Patches taken from http://pkgs.fedoraproject.org/cgit/nss.git/
Following patches were applied in that order:
nss-enable-pem.patch
0039-Sync-up-with-nss-3.15.4-changes-in-freebl-and-softok.patch
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
[ 28.693672] [drm] amdgpu kernel modesetting enabled.
[ 28.699541] amdgpu: Topology: Add APU node [0x0:0x0]
[ 28.699778] amdgpu 0000:30:00.0: enabling device (0000 -> 0003)
[ 28.699971] [drm] initializing kernel modesetting (RAVEN 0x1002:0x15D8 0x1002:0x15D8 0xC8).
[ 28.699994] amdgpu 0000:30:00.0: amdgpu: Trusted Memory Zone (TMZ) feature enabled
[ 28.700365] [drm] register mmio base: 0xFCC00000
[ 28.700376] [drm] register mmio size: 524288
[ 28.700400] [drm] add ip block number 0 <soc15_common>
[ 28.700413] [drm] add ip block number 1 <gmc_v9_0>
[ 28.700434] [drm] add ip block number 2 <vega10_ih>
@rb2k
rb2k / epub_compressor.rb
Created May 22, 2016 17:34
Quick hack to recompress epub files
def compress(file)
raise unless system("rm -rf tmp/")
raise unless system("unzip -q -o -d tmp/ '#{file}'")
raise unless system("imageOptim --directory tmp/ ")
raise unless system("pushd tmp/ && zip -q -9 -rX '#{file}' 'mimetype' '*' && popd")
end
def filesize(file)
'%.2f' % (File.size(file).to_f / 2**20)
end
@rb2k
rb2k / ip_country.rb
Created August 15, 2013 19:06
IP country lookup generator thingy
require 'open-uri'
require 'ipaddr'
def generate_lookup_table
delegation_lists = [
'ftp://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-latest',
'ftp://ftp.apnic.net/pub/stats/apnic/delegated-apnic-latest',
'ftp://ftp.arin.net/pub/stats/arin/delegated-arin-latest',
'ftp://ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-latest',
'ftp://ftp.ripe.net/pub/stats/ripencc/delegated-ripencc-latest'
require "rubygems"
require 'rethinkdb'
require 'oj'
require 'multi_json'
include RethinkDB::Shortcuts
r.connect({:db => 'testing'}).repl
r.db_drop('test_db').run rescue nil
r.db_create('test_db').run
r.db('test_db').table_create('data', {:durability => 'soft'}).run
@rb2k
rb2k / gist:1451396
Created December 9, 2011 12:47
threading problems?
*** longjmp causes uninitialized stack frame ***: ruby terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7f1bc849d217]
/lib/libc.so.6(+0xff1a9)[0x7f1bc849d1a9]
/lib/libc.so.6(__longjmp_chk+0x33)[0x7f1bc849d113]
/usr/lib/libcurl.so.4(+0x91e5)[0x7f1bc5f001e5]
/lib/libpthread.so.0(+0xf8f0)[0x7f1bc8ff88f0]
/lib/libpthread.so.0(pthread_cond_wait+0xcc)[0x7f1bc8ff485c]
/usr/local/rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(+0x180d69)[0x7f1bc9386d69]
/usr/local/rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(+0x18549b)[0x7f1bc938b49b]