Skip to content

Instantly share code, notes, and snippets.

@philroche
philroche / Dockerfile
Created August 27, 2024 08:28
Simple wolfi based dockerfile
FROM cgr.dev/chainguard/wolfi-base
RUN apk update && apk add --no-cache --update-cache curl jq
CMD curl -s https://api.adviceslip.com/advice --http1.1 | jq .slip.advice
@philroche
philroche / github-compare-summary-update-pr.sh
Created August 19, 2024 14:41
Helpful script to summarize the commits and files changes between two git SHAs or branches or tags using the github API and updating a wolfi version update pull request with the summary.
#!/bin/bash -eu
# Helpful script to summarize the commits and files changes between two git SHAs or branches or tags using the github API and updating a wolfi version update pull request with the summary.
# This is very specific to wolfi version update PRs.
# Usage: ./github-compare-summary-update-pr.sh <wolfi version update PR URL>
# Example: ./github-compare-summary-update-pr.sh "https://github.com/wolfi-dev/os/pull/26617"
base_url="https://api.github.com/repos/"
# get the repo as the first argument
version_bump_pull_request_url=$1
@philroche
philroche / github-compare-summary.sh
Last active August 19, 2024 12:19
Helpful script to summarize the commits between two git SHAs or branches or tags using the github API
#!/bin/bash -eu
# Helpful script to summarize the commits and files changes between two git SHAs or branches or tags using the github API
# Usage: ./github-compare-summary.sh <repo> <from_sha> <to_sha>
# Example: ./github-compare-summary.sh "awslabs/aws-c-http" "v0.8.7" "v0.8.8"
# Example: ./github-compare-summary.sh "awslabs/aws-c-http" "7db2452238caece2d3a91e6cbed75324edccea7d" "4e74ab1e3702763e0b87bd1752f5a37c2f0400ac"
# Example: ./github-compare-summary.sh "kubernetes-sigs/kubebuilder" "v4.1.1" "v4.2.0"
base_url="https://api.github.com/repos/"
# get the repo as the first argument
repo=$1
@philroche
philroche / local-registry-images.sh
Created August 9, 2024 15:40
List images in local container image registry if using docker.io/library/registry image
#!/bin/bash
# Set the registry URL
registry_url="http://localhost:5005"
# List repositories
repositories=$(curl -s "${registry_url}/v2/_catalog" | jq -r '.repositories[]')
# List tags for each repository
for repo in ${repositories}; do
@philroche
philroche / find-wolfi-dependencies.sh
Last active August 2, 2024 12:37
Find all packages dependent on a given package across all wolfi package repositories
#!/bin/bash -eu
# Find all packages dependent on a given package across all wolfi package repositories
# Usage: ./find-wolfi-dependencies.sh <package_to_query>
# Example: ./find-wolfi-dependencies.sh "python3"
# package_to_query is the package name to query and is required
# If package_to_query is not provided, the script will exit with an error
package_to_query=${1:-}
if [ -z "${package_to_query}" ]; then
echo "Usage: ${0} <package_to_query>"
@philroche
philroche / ubuntu_package_download_deb.py
Last active February 26, 2024 19:44
Download a deb from launchpad for a specific package version and architecture
#!/usr/bin/env python3
import faulthandler
import functools
import logging
import sys
import click
from debian import debian_support
@philroche
philroche / launch-qcow2-image-qemu-40G.sh
Created November 8, 2023 08:39
launch-qcow2-image-qemu-40G.sh
#!/bin/bash -eu
LAUNCHPAD_USER=""
LAUNCHPAD_USER_STRING=""
GIT_HUB_USER=""
GIT_HUB_USER_STRING=""
SSH_KEY=""
SSH_KEY_STRING=""
CREATE_BACKDOOR_USER="false"
PLAIN_TEXT_PASSWORD=""
@philroche
philroche / bash-to-zsh-hist.py
Created January 17, 2022 08:58 — forked from muendelezaji/bash-to-zsh-hist.py
Convert Bash history to Zsh history
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history
import sys
import time
@philroche
philroche / configure-nodes-for-ssh-access.sh
Last active October 21, 2021 12:23
Configure SSH for access across nodes - 2021 PTG directord hackfest
# Get SSH-config for nodes
vagrant ssh-config node0 > node0.ssh-config
vagrant ssh-config node1 > node1.ssh-config
# get teh SSH key path from the ssh-config
node0_ssh_key=$(ssh -F ./node0.ssh-config -G node0 | grep -m1 -oP "(?<=identityfile ).*")
echo ${node0_ssh_key}
node1_ssh_key=$(ssh -F ./node1.ssh-config -G node1 | grep -m1 -oP "(?<=identityfile ).*")
echo ${node1_ssh_key}
@philroche
philroche / healthchecks.sh
Created May 14, 2021 14:43 — forked from rcj4747/healthchecks.sh
Run a command and report status to https://healthchecks.io
#!/bin/bash -eu
set -o pipefail
# Run a command and report status to https://healthchecks.io
usage() {
echo "Usage: $0 <healthchecks.io UUID> <command>"
exit 1
}
trap usage EXIT