Skip to content

Instantly share code, notes, and snippets.

@chashtag
chashtag / gist:97a5e0f941accd02f686581c9da1042f
Created September 25, 2025 13:22
public.cyber.mil STIG downloader
curl -k 'https://www.cyber.mil/webruntime/api/apex/execute?language=en-US&asGuest=true&htmlEncode=false' \
--compressed \
-X POST \
-H 'Content-Type: application/json; charset=utf-8' \
-H 'Origin: https://www.cyber.mil' \
--data-raw '{"namespace":"","classname":"@udd/01pRw0000002mOj","method":"getCyberDocumentCatalogByDocumentLibrary","isContinuation":false,"params":{"documentLibrary":"STIGs"},"cacheable":false}' \
| jq -r '.returnValue[].S3_Link__c ' | aria2c -i - --check-certificate=false -d .
@chashtag
chashtag / luks-ks.cfg
Created July 24, 2025 18:16
luks-ks.cfg
url --url="https://mirror.fcix.net/fedora/linux/releases/42/Everything/x86_64/os/"
repo --name=fedora-updates --baseurl="https://mirror.fcix.net/fedora/linux/releases/42/Everything/x86_64/os/" --install
clearpart --all
zerombr
part /boot/efi --fstype=efi --label=BOOT --size=2048 --ondisk=/dev/vda
part /boot --fstype=xfs --size=1024 --ondisk=/dev/vda
part pv.01 --asprimary --size=1 --grow --encrypted --passphrase=changeme --ondisk=/dev/vda
volgroup vg pv.01
@chashtag
chashtag / gist:374636d6a2a0f1a263a1fb11ba4cbbcd
Last active May 30, 2025 13:32
quick fedora testing vm
wget -O /var/lib/libvirt/images/fedora-42-base.qcow2 https://solidrock.mm.fcix.net/fedora/linux/releases/42/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-42-1.1.x86_64.qcow2
qemu-img create /var/lib/libvirt/images/fedora-test.qcow2 -f qcow2 40G
virt-resize /var/lib/libvirt/images/fedora-42-base.qcow2 /var/lib/libvirt/images/fedora-test.qcow2 --expand /dev/sda4
virt-customize --root password:password -a /var/lib/libvirt/images/fedora-test.qcow2
virt-install --name fedora-test --memory 12048 --vcpus 4 --disk /var/lib/libvirt/images/fedora-test.qcow2,bus=virtio --import --os-variant fedora-rawhide --boot uefi --noautoconsole
@chashtag
chashtag / dump.sh
Last active May 6, 2025 12:13
Dump docker containers into quadlets
mkdir quadlet/containers
TEMPLATE=$(curl -s https://gist.githubusercontent.com/chashtag/34d7dc74c06104d9ce941d8037e81e7f/raw/cc752c0d5cf4e290c36382a370e2a04a3cd5f7c6/run.tpl)
for CONTAINERNAME in $(docker ps -a --format '{{.Names}}')
do
echo "Dumping $CONTAINERNAME"
echo $(docker inspect --format "$TEMPLATE" $CONTAINERNAME) | sed 's/ \\ / /g' | xargs podlet > quadlet/containers/$CONTAINERNAME.container
done
@chashtag
chashtag / run.tpl
Last active May 6, 2025 12:07 — forked from efrecon/run.tpl
`docker inspect` template to regenerate the `docker run` command that created a container -- forked to modify for use with podlet
run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}
@chashtag
chashtag / 30-docker.conf
Created January 21, 2025 23:05
fapolicyd docker
#cat /etc/fapolicyd/rules.d/30-docker.conf
allow perm=any all : dir=/run/containerd/
@chashtag
chashtag / gist:7f7c0982a1cbdb66b8fb96919ba98b31
Created January 21, 2025 15:33
get last 10 docker tags for jfrog artifactory
#!/usr/bin/env python3
import requests
from packaging.version import Version
[(S := requests.Session()).headers.update({'Authorization': f'Bearer {S.get("https://releases-docker.jfrog.io/artifactory/api/docker/docker/v2/token?scope=repository%3Ajfrog%2Fartifactory-pro%3Apull&service=releases-docker.jfrog.io").json().get("token")}'}),[print(tag) for tag in sorted([tag for tag in S.get('https://releases-docker.jfrog.io/v2/jfrog/artifactory-pro/tags/list').json().get('tags',[]) if all(c.isdigit() or c == '.' for c in tag)],key=Version)[-10:]+['latest']]]
#./fetch_containers.py | xargs -I {} skopeo sync -d docker -s docker releases-docker.jfrog.io/jfrog/artifactory-pro:{} harbor.home/jfrog/artifactory-pro --dest-tls-verify=false
apiVersion: mirror.openshift.io/v1alpha2
archiveSize: 4
kind: ImageSetConfiguration
mirror:
additionalImages: []
helm: {}
operators:
- catalog: registry.redhat.io/redhat/community-operator-index:v4.13
packages:
- name: gitlab-runner-operator
@chashtag
chashtag / fedora-mirror.sh
Created May 13, 2024 18:06
get fastest fedora repo
curl -s 'https://mirrors.fedoraproject.org/metalink?repo=fedora-40&arch=x86_64&country=US' | grep -Po 'https{0,1}://.+?fedora/linux' | xargs -i{} -P 3 bash -c "curl -qfsS -w '%{speed_download}' {}/releases/40/Everything/x86_64/os/Packages/g/gap-pkg-smallgrp-1.5.3-6.fc40.noarch.rpm -o /dev/null; echo ' {}'" | sort -nr
apt-get update -y
apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \