Skip to content

Instantly share code, notes, and snippets.

View yakatz's full-sized avatar

Yehuda Katz yakatz

View GitHub Profile
@yakatz
yakatz / backup-slack.sh
Last active September 25, 2024 01:41
Slack Auto-Backup Script
#! /bin/bash
cd "$(dirname "$0")"
logger="logger --stderr --id=$$ --tag slack-archive"
metadata_filename="metadata.json"
$logger "Start Backup: $(pwd)"
if [[ ! -s $metadata_filename ]]; then
@yakatz
yakatz / generate-mermaid.mjs
Created August 7, 2024 14:57
Script to generate `mermaid` diagrams
//jshint esversion:8
//jshint node:true
import fs from 'fs';
import path from 'path';
import { run as mermaidRun } from "@mermaid-js/mermaid-cli"
const srcDir = "./mermaid";
const dstDir = "./generated";
const outputFormat = "png";
@yakatz
yakatz / output.txt
Last active August 8, 2023 14:51
pmtx strace Qualstar TLS-58132
root@robot00:~# strace -fyy pmtx status --changer robot0
execve("/usr/bin/pmtx", ["pmtx", "status", "--changer", "robot0"], 0x7fff81ae0c10 /* 18 vars */) = 0
brk(NULL) = 0x55ffe2d00000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1472399000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD</root>, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3</etc/ld.so.cache>
newfstatat(3</etc/ld.so.cache>, "", {st_mode=S_IFREG|0644, st_size=15306, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 15306, PROT_READ, MAP_PRIVATE, 3</etc/ld.so.cache>, 0) = 0x7f1472395000
close(3</etc/ld.so.cache>) = 0
openat(AT_FDCWD</root>, "/lib/x86_64-linux-gnu/libsgutils2-1.46.so.2", O_RDONLY|O_CLOEXEC) = 3</usr/lib/x86_64-linux-gnu/libsgutils2-1.46.so.2.0.0>
@yakatz
yakatz / example_usage.pp
Created May 25, 2022 15:44
Manage System Git Config with Puppet
class myweb::sites::wiki_example_com {
wiki_base = '/var/www/sites/wiki.example.com'
include ::profile::gitconfig
profile::gitconfig::safe_directory {"${wiki_base}/code/mediawiki-1.35-LTS":}
vcsrepo { "${wiki_base}/code/mediawiki-1.35-LTS/":
ensure => latest,
provider => git,
source => '[email protected]:wiki/mediawiki-1.35-LTS.git',
@yakatz
yakatz / login.js
Created January 1, 2019 04:47
Github login notification
window.addEventListener("storage", function(t) {
if (t.storageArea === window.localStorage && "logged-in" === t.key && ("true" === t.newValue || "false" === t.newValue) && t.newValue !== a) {
a = t.newValue;
var n = e.query(document, ".js-stale-session-flash");
n.classList.toggle("is-signed-in", "true" === a),
n.classList.toggle("is-signed-out", "false" === a),
n.classList.remove("d-none"),
window.addEventListener("popstate", function(e) {
e.state && null != e.state.container && location.reload()
}),
@yakatz
yakatz / Rspec output
Last active December 7, 2018 19:24
puppetlabs-apache bundle
ykatz@ykatz:~/local_git/puppetlabs-apache (feature/master/cas_root_proxied_as $=)$ bundle exec rspec spec/acceptance
/home/ykatz/.rvm/gems/ruby-2.5.1@puppet/gems/beaker-rspec-6.2.4/lib/beaker-rspec/helpers/serverspec.rb:43: warning: already initialized constant Module::VALID_OPTIONS_KEYS
/home/ykatz/.rvm/gems/ruby-2.5.1@puppet/gems/specinfra-2.76.3/lib/specinfra/configuration.rb:4: warning: previous definition of VALID_OPTIONS_KEYS was here
Beaker::Hypervisor, found some vagrant boxes to create
Bringing machine 'ubuntu-1404-x64' up with 'virtualbox' provider...
==> ubuntu-1404-x64: Importing base box 'puppetlabs/ubuntu-14.04-64-nocm'...
Progress: 10%Progress: 20%Progress: 30%Progress: 40%Progress: 50%Progress: 60%Progress: 70%Progress: 80%Progress: 90%==> ubuntu-1404-x64: Matching MAC address for NAT networking...
==> ubuntu-1404-x64: Checking if box 'puppetlabs/ubuntu-14.04-64-nocm' is up to date...
==> ubuntu-1404-x64: Setting the name of the VM: defaultyml_ubuntu-1404-x64_1544202699683_31654
==> ubuntu-140
@yakatz
yakatz / my-bridge-ctl.sh
Created March 19, 2018 18:04
netplugd bridge sync script
#!/bin/bash
## This script will bounce a br interface if a member interface goes down.
## This will cause router BGP timers to reset, making outages last only seconds instead of minutes.
##
## This script is called by netplug on Vyos:
## /etc/netplug/linkdown.d/my-brdown
##
## Version History
## 1.0 - Initial version
Alias /custom-errors /etc/httpd/conf/errors
<Directory /etc/httpd/conf/errors>
Options +Includes
</Directory>
@yakatz
yakatz / reload-webservers.sh
Created April 24, 2017 03:46
Let's Encrypt Renewal Script
!/bin/bash
# Create the following CRON job
# 25 */12 * * * /usr/bin/certbot-auto renew --post-hook "/opt/reload-webservers.sh" --noninteractive
# You can change the minute time to a random value, but the job should run every 12 hours.
# Customize the list of services below that use Let's Encrypt certificates
/usr/sbin/service nginx reload
/usr/sbin/service apache2 reload
@yakatz
yakatz / check_pfsense_rtt.sh
Created August 15, 2014 03:43
pfSense NRPE Multiple Gateway RTT Check
#!/bin/sh
# check_pfsense_rtt2.1.4 Version 0.2
# Based on Copyright 2012, Justin Edmands, [email protected]
# Modified 2014, Yehuda Katz, [email protected]
# Info available from http://justinedmands.com/?q=nagios_check_pfsense_rtt
# License for use: http://www.opensource.org/licenses/bsd-license.php
# place this file in your pfsense nagios plugin directory. As of pfsense 2.0.2, this is /usr/local/libexec/nagios. Make the plugin executable with chmod 755.
# In later pfSense versions, this is /usr/pbi/nrpe-*/libexec/nagios/
# This is compatible with pfsense 2.1.4