Skip to content

Instantly share code, notes, and snippets.

View jamesfreeman959's full-sized avatar

James Freeman jamesfreeman959

  • London, England
View GitHub Profile
@jamesfreeman959
jamesfreeman959 / update-route53.sh
Created July 23, 2018 14:25
A simple bash script for updating an A record in AWS Route 53
#!/bin/bash
# (optional) You might need to set your PATH variable at the top here
# depending on how you run this script
#PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Hosted Zone ID e.g. BJBK35SKMM9OE
ZONEID=""
# The CNAME you want to update e.g. hello.example.com
@jamesfreeman959
jamesfreeman959 / notes-lmde-with-lvm-on-luks.txt
Created June 21, 2018 12:35 — forked from seanorama/notes-lmde-with-lvm-on-luks.txt
Install LMDE (Linux Mint Debian Edition) with LVM on LUKS (encryption) & hibernation support
# Title: Install LMDE (Linux Mint Debian Edition) 17 with LVM on LUKS (encryption) & hibernation support
#
# Description: These are very rough notes for installing LMDE with
# encryption via LVM on top of LUKS.
# - This includes SWAP being within LUKS
# - Includes fixing hibernation (which will also apply to Debian Jessie or greater)
########
# 1. Boot from LMDE DVD/USB/...
@jamesfreeman959
jamesfreeman959 / keepawake.ps1
Last active November 10, 2024 14:01
A very simple PowerShell script to keep a Windows PC awake and make lync think the user is active on the keyboard
# Useful references:
#
# https://superuser.com/questions/992511/emulate-a-keyboard-button-via-the-command-line
# https://ss64.com/vb/sendkeys.html
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/96b339e2-e9da-4802-a66d-be619aeb21ac/execute-function-one-time-in-every-10-mins-in-windows-powershell?forum=winserverpowershell
# https://learn-powershell.net/2013/02/08/powershell-and-events-object-events/
#
# Future enhancements - use events rather than an infinite loop
$wsh = New-Object -ComObject WScript.Shell
while (1) {
@jamesfreeman959
jamesfreeman959 / quru-meetup-proxy.sh
Created October 31, 2017 17:41
quru-meetup-proxy.sh
echo "proxy=http://172.16.190.14:3128" >> /etc/yum.conf
sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/*.repo
sed -i 's/^#baseurl/baseurl/g' /etc/yum.repos.d/*.repo
rm -f /etc/yum/pluginconf.d/fastestmirror.conf
@jamesfreeman959
jamesfreeman959 / selinux-funcs-el7.txt
Last active February 16, 2022 09:46
Useful SELinux Functions based on http://dev.gentoo.org/~swift/blog/01/selinux-funcs.txt but modified to be EL7 specific
# sefindif - Find interface definitions that have a string that matches the
# given regular expression
sefindif() {
REGEXP="$1";
pushd /usr/share/selinux/devel/include > /dev/null 2>&1;
for FILE in */*.if;
do
awk "/(interface\(|template\()/ { NAME=\$NF; P=0 }; /${REGEXP}/ { if (P==0) {P=1; print NAME}; print };" ${FILE} | sed -e "s:^:${FILE}\: :g";
done
popd > /dev/null 2>&1;
"""
Requirements:
$ sudo pip install boto dnspython
Edit ~/.boto to use your AWS credentials
"""
import time
import sys