Skip to content

Instantly share code, notes, and snippets.

View FreedomBen's full-sized avatar
💭
Currently setting my status

Ben Porter FreedomBen

💭
Currently setting my status
View GitHub Profile
@FreedomBen
FreedomBen / .bashrc
Created December 28, 2023 19:25
Bash functions for controlling a chromecast with google TV from the CLI
adbdevicecount()
{
adb devices | grep -P '\sdevice$' | sed -e 's/device//g' | wc -l
}
adbkeyevent()
{
if [ -z "${1}" ]; then
echo "oops! Pass one arg with button. example 'adbkeyevent ENTER'"
elif [ -z "${ANDROID_SERIAL}" ] && [ "$(adbdevicecount)" = '1' ]; then
@FreedomBen
FreedomBen / arch-linux-install.md
Created August 17, 2016 18:42 — forked from defektive/arch-linux-install.md
Arch Linux, UEFI, Existing LUKS, NVMe install guide
@FreedomBen
FreedomBen / digall.sh
Last active August 11, 2023 10:42
A bash command that will run a `dig` against a specified target for all record types
#!/usr/bin/env bash
#
# To use, simply run `digall <domain>` such as:
#
# digall example.com
# digall sub.example.com
#
# Place this file in your PATH. Suggest either /usr/local/bin/ or ~/bin
#
@FreedomBen
FreedomBen / Passwords.md
Last active February 18, 2023 23:16
A helpful FAQ for sharing passwords!

Password sharing at SimpleNexus

Hello there! You may be trying to share a password with a coworker.
If that is you, you're in luck my friend! This document will help you to do so in a safe and secure manner.

You have a few options:

  1. Tell the person the password in real life
  2. Call the person on the phone and pass it that way
  3. Write it down on a piece of paper and give it to them. Make sure to destroy the paper afterward. Don't just throw it away!
@FreedomBen
FreedomBen / keyevents.json
Created December 8, 2022 18:03 — forked from arjunv/keyevents.json
All Android Key Events for usage with adb shell
{
"key_events": {
"key_unknown": "adb shell input keyevent 0",
"key_soft_left": "adb shell input keyevent 1",
"key_soft_right": "adb shell input keyevent 2",
"key_home": "adb shell input keyevent 3",
"key_back": "adb shell input keyevent 4",
"key_call": "adb shell input keyevent 5",
"key_endcall": "adb shell input keyevent 6",
"key_0": "adb shell input keyevent 7",
#!/usr/bin/env bash
# Versoin one
oc get $(oc api-resources --namspaced=true | tail -n+2 | awk '{ print $1 }' | xargs | sed -e 's/\s/,/g')
# Version two (from https://access.redhat.com/solutions/4165791)
oc api-resources --verbs=list --namespaced -o name | xargs -n 1 oc get --show-kind --ignore-not-found -n $PROJECT_NAME
@FreedomBen
FreedomBen / retrieved-deployment-basic-ocp-demo.yaml
Created January 8, 2021 02:16
Deployment read back from OpenShift API with `oc get deployment basic-ocp-demo -o yaml`
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"labels":{"app":"basic-ocp-demo"},"name":"basic-ocp-demo","namespace":"basic-ocp-demo-project"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"basic-ocp-demo"}},"template":{"metadata":{"labels":{"app":"basic-ocp-demo"}},"spec":{"containers":[{"env":[{"name":"BASIC_OCP_DEMO_ENV","value":"master"}],"image":"quay.io/freedomben/basic-ocp-demo:latest","imagePullPolicy":"Always","name":"basic-ocp-demo","ports":[{"containerPort":4567,"protocol":"TCP"}],"readinessProbe":{"httpGet":{"path":"/healthz","port":4567,"scheme":"HTTP"},"initialDelaySeconds":5,"periodSeconds":1}}]}}}}
creationTimestamp: "2021-01-08T02:09:21Z"
generation: 1
labels:
curl -k "https://basic-ocp-demo-basic-ocp-demo-project.apps.cluster1.example.com/healthz"
# or build the curl URL programmatically!
curl -k "https://$(oc get route basic-ocp-demo -o jsonpath="{.spec.host}")/healthz"
@FreedomBen
FreedomBen / vmware2libvirt.py
Created June 17, 2022 01:56
Python script to convert VMware image format to libvirt XML
#! /usr/bin/env python
#
# vmware2libvirt: migrate a vmware image to libvirt
# Author: Jamie Strandboge <jamie@canonical.com>
#
# Copyright (C) 2008 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3,
# as published by the Free Software Foundation.
# Install cockpit and pcp and activate services
dnf install -y cockpit pcp cockpit-pcp
systemctl enable --now cockpit.socket
systemctl enable --now pmlogger
# If needed, open port 9090 in the firewall
firewall-cmd --zone=public --permanent --add-service=cockpit
# Alternatively you can open port 9090 to only your own IP
firewall-cmd --zone=public --permanent --add-rich-rule='rule family="ipv4" source address="38.14.154.124" port protocol="tcp" port="9090" accept'