Skip to content

Instantly share code, notes, and snippets.

View larsks's full-sized avatar

Lars Kellogg-Stedman larsks

View GitHub Profile
@larsks
larsks / fibtrace.bt
Last active November 11, 2022 04:44
Track routing decisions made by fib_validate_source
kprobe:fib_validate_source {
$skb = (struct sk_buff*) arg0;
@skb[tid] = $skb;
@ipheader[tid] = ((struct iphdr *) ($skb->head + $skb->network_header));
}
kretprobe:fib_validate_source {
$skb = @skb[tid];
$ipheader = @ipheader[tid];
$version = $ipheader->version;
-- Description:
-- ------------
--
-- This is an example schema for storing collectd metrics in a TimescaleDB
-- dabase (see https://www.timescale.com/). It is based on the PostgreSQL
-- schema contributed by Sebastian Harl.
--
-- Prerequisities:
-- ---------------
--
@larsks
larsks / generate_password-2.ps1
Created November 4, 2012 13:34
Generating a random password using Get-Random
# Generate a random password
# Usage: random-password <length>
Function random-password ($length = 15)
{
$punc = 46..46
$digits = 48..57
$letters = 65..90 + 97..122
# Thanks to
# https://blogs.technet.com/b/heyscriptingguy/archive/2012/01/07/use-pow
@larsks
larsks / wait-for-network.ps1
Created November 4, 2012 12:56
Wait until networking is available with PowerShell
# Wait for a DHCP-enabled interface to develop
# a default gateway.
#
# usage: wait-for-network [ <tries> ]
function wait-for-network ($tries) {
while (1) {
# Get a list of DHCP-enabled interfaces that have a
# non-$null DefaultIPGateway property.
$x = gwmi -class Win32_NetworkAdapterConfiguration `
-filter DHCPEnabled=TRUE |
@larsks
larsks / -
Created October 9, 2013 16:16
#!/bin/sh
systemctl --version >/dev/null 2>&1 && systemctl=1
[ "$systemctl" ] || RUNLEVEL=$(LANG=C who -r | sed 's/.*run-level \([0-9]\).*/\1/')
enabled_services() {
if [ "$systemctl" = 1 ]; then
ls /etc/systemd/system/multi-user.target.wants/ | sed 's/.service$//'
else
chkconfig --list | grep "${RUNLEVEL}:on" | awk '{print $1}'
@larsks
larsks / newkey
Last active March 14, 2022 20:29
#!/bin/bash
# GPG is hard.
#
# Best practice suggests that you should generate separate signing subkeys for
# regular use while protecting your primary key for exceptional purposes, such
# as key signing. Creating the necessary subkeys can involve a lot of typing.
#
# Other tools, such as [monkeysphere][], want an authentication subkey. Generating
# this yourself requires the `--expert` option to `--edit-key` and presents other
@larsks
larsks / gist:5009872
Created February 22, 2013 00:45
A systemd unit for ucarp. This is a templated service; call it like `systemctl start ucarp@001` to start up ucarp using `/etc/ucarp/vip-001.conf`.
[Unit]
Description=UCARP virtual interface %I
After=network.target
[Service]
Type=simple
EnvironmentFile=-/etc/ucarp/vip-common.conf
EnvironmentFile=-/etc/ucarp/vip-%I.conf
ExecStart=/usr/sbin/ucarp -i $BIND_INTERFACE -p $PASSWORD -v %I -a $VIP_ADDRESS -s $SOURCE_ADDRESS $OPTIONS -u $UPSCRIPT -d $DOWNSCRIPT
KillMode=control-group
{
"definitions": {
"Group": {
"description": "A user.openshift.io/v1 Group",
"properties": {
"apiVersion": {
"default": "user.openshift.io/v1",
"title": "Apiversion",
"type": "string"
},
import logging
import os
import pytest
import requests
ENDPOINT = os.environ.get("ACCT_MGR_API_ENDPOINT", "http://localhost:8080")
ADMIN_PASSWORD = os.environ.get("ACCT_MGR_ADMIN_PASSWORD", "pass")
NS = os.environ.get("ACCT_MGR_NAMESPACE", "onboarding")

If you run:

ansible-playbook playbook.yml  -e target_address='10.216.14.8'

You get as output:

PLAY [localhost] ***************************************************************