Skip to content

Instantly share code, notes, and snippets.

@GeoffWilliams
GeoffWilliams / fakerpm.sh
Created May 4, 2017 14:28
Generate dummy/fake RPMs - great for acceptance testing systems
#!/bin/bash
#
# From: https://www.redhat.com/archives/rpm-list/2006-November/msg00062.html
#
# Generate dummy/fake RPMs - great for acceptance testing systems
#
NAME=$1
#
# GEnerate Provides:
@GeoffWilliams
GeoffWilliams / test_socket.py
Created October 16, 2022 21:55
test_socket.py
#!/usr/bin/env python3
import socket
import sys
s = socket.socket()
if len(sys.argv) != 3:
print(f"usage: {sys.argv[0]} HOSTNAME PORT")
sys.exit(1)
address = sys.argv[1]
@GeoffWilliams
GeoffWilliams / privoxy_rules.txt
Created September 29, 2014 03:55
firewall rules - privoxy
uci add firewall redirect
uci set firewall.@redirect[0].name='Transparent Proxy Redirect (privox)'
uci set firewall.@redirect[0].src=lan
uci set firewall.@redirect[0].proto=tcp
uci set firewall.@redirect[0].dest_port=8118
uci set firewall.@redirect[0].src_dport=80
uci set firewall.@redirect[0].src_dip='!192.168.1.1'
uci set firewall.@redirect[0].dest_ip=192.168.1.1
uci set firewall.@redirect[0].target='DNAT'
uci commit firewall
DO
$$BEGIN
IF EXISTS (SELECT FROM pg_roles WHERE rolname = 'my_user') THEN
EXECUTE 'ALTER USER...';
ELSE
EXECUTE 'CREATE USER...';
END IF;
END$$;
@GeoffWilliams
GeoffWilliams / artifactory_download_size.py
Last active July 17, 2021 05:19
Quick and dirty python script to output human readable artifact names for large downloads
#!/usr/bin/env python
"""artifactory download size
Usage:
artifactory_download_size.py <filename>
artifactory_download_size.py (-h | --help)
Options:
-h --help Show this screen
"""
@GeoffWilliams
GeoffWilliams / check_csr.sh
Created April 12, 2015 16:03
policy based autosigning with puppet
#!/bin/bash
# define the shared secret we will accept to authenticate identity
SHARED_SECRET="your the best"
# capture the certname (hostname) used for the request
CERT_NAME=$1
# feed STDIN (file descriptor 0) to the openssl command and pipe
# the output to grep to get the sharedSecret supplied by the agent
# capturing the value in a variable called AGENT_SECRET
@GeoffWilliams
GeoffWilliams / debuild_ubuntu_debian_package
Created November 5, 2015 10:40
Command to run to build debian packages on ubuntu, fixes bad-distribution-in-changes error, needed for the steps to patch a debian package listed at https://raphaelhertzog.com/2011/07/04/how-to-prepare-patches-for-debian-packages/
# How to run debuild with lintian on ubuntu
# fixes error: bad-distribution-in-changes-file unstable
# Finished running lintian.
debuild -us -uc --lintian-opts --profile debian
@GeoffWilliams
GeoffWilliams / boxcutter-windows-vmware15.patch
Created March 5, 2020 05:42
Support building eval copy of windows10 for vmware 15 - using upstream the virus checker usually fails the build and the virtual hardware is too old to work properly (get unknown error from vagrant, cannot power on error from vmware)
diff --git a/eval-win10x64-enterprise.json b/eval-win10x64-enterprise.json
index 6ec43db..d33e59c 100644
--- a/eval-win10x64-enterprise.json
+++ b/eval-win10x64-enterprise.json
@@ -186,10 +186,10 @@
"vm_suffix": "",
"cm": "chef",
"cm_version": "",
- "cpus": "2",
- "memory": "2048",
@GeoffWilliams
GeoffWilliams / ssm.yml
Created December 23, 2019 02:23
ansible playbook to install aws ssm on debian
---
- name: install ssm
hosts: all
tasks:
- name: script
shell: >
wget https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_amd64/amazon-ssm-agent.deb &&
sudo dpkg -i amazon-ssm-agent.deb &&
sudo systemctl enable amazon-ssm-agent
@GeoffWilliams
GeoffWilliams / pydiskcomp.py
Created September 21, 2019 03:06
Compare disk images block-by-block, print out index of sectors with changes and save the different blocks to file
import os
afile = "sdcard.img"
bfile = "sdcard.img.manualworks"
afilediff = "sdcard.img.diff"
bfilediff = "sdcard.img.manualworks.diff"
afile_size = os.path.getsize(afile)
bfile_size = os.path.getsize(bfile)