Skip to content

Instantly share code, notes, and snippets.

View markallenpark's full-sized avatar

Mark Allen Park markallenpark

View GitHub Profile
@markallenpark
markallenpark / cockpit-ipa-cert.sh
Last active February 18, 2024 21:36
Have cockpit use CA certificates from FreeIPA on Fedora 28+ or RHEL 8+
#!/bin/bash
##
# Simple script to get cockpit to use certs issued by FreeIPA, rather than
# self-signed certificates.
#
# This script is for distributions compatible with RHEL 8 or newer, and Fedora 28 or newer.
# Older versions will require extra steps. I don't run anything older than RHEL 9 or
# Fedora 39, so I didn't bother with those.
#
@markallenpark
markallenpark / client_ip.php
Created September 25, 2023 20:08
Simple utility to display external IP for updating dyndns
<?php
$client_ip = $_SERVER['REMOTE_ADDR'];
$ip_version = (filter_var($client_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) ?
'4' :
'6';
$tz = new DateTimeZone('UTC');
$datetime = new DateTime();
$datetime->setTimezone($tz);
@markallenpark
markallenpark / octmod.sh
Created June 1, 2023 08:21
simple script to show octal values of file permissions in a path. I didn't write this, I just have it here for easy access.
#!/bin/sh
ls -l | awk '{
k = 0
s = 0
for( i = 0; i <= 8; i++ )
{
k += ( ( substr( $1, i+2, 1 ) ~ /[rwxst]/ ) * 2 ^( 8 - i ) )
}
j = 4
@markallenpark
markallenpark / keybase.md
Created August 31, 2022 09:02
Keybase Proof

Keybase proof

I hereby claim:

  • I am markallenpark on github.
  • I am markallenpark (https://keybase.io/markallenpark) on keybase.
  • I have a public key whose fingerprint is 702D E428 F8AB 0252 2C1A 9607 B187 83B1 C7B7 C1CF

To claim this, I am signing this object:

@markallenpark
markallenpark / genpass.py
Created June 17, 2022 23:29
Generate password hash for including in cloud-init scripts
#!/bin/env python3
import crypt
from getpass import getpass
print('Generate password hash\n\n----\n')
password = getpass('Password: ')
password_confirm = getpass('Confirm Password: ')
print('\n')
@markallenpark
markallenpark / papermc.service
Created March 7, 2022 18:12
Systemd service wrapper for PaperMC
[Unit]
Description=PaperMC Server
After=network.target
[Service]
WorkingDirectory=/opt/paper
User=paper
Group=paper
@markallenpark
markallenpark / paperctl
Created March 7, 2022 18:10
Send commands to paper controlled by screen
#!/bin/env python3
import os
import sys
def sendCommand(command):
os.system('/usr/bin/screen -p 0 -S paper -X stuff "' + command + '"')
def getCommand():