Skip to content

Instantly share code, notes, and snippets.

View darth-veitcher's full-sized avatar

James Veitch darth-veitcher

View GitHub Profile
@darth-veitcher
darth-veitcher / iterate-words-in-line-in-file.sh
Created May 7, 2016 15:31
Bash iterate file and split lines
while read listing; do words=( $listing ); echo wget -O ${words[0]} \"${words[1]}\"; done < test.txt
@darth-veitcher
darth-veitcher / freenas.ext2.single.disc.md
Last active June 20, 2016 16:21
Creating and using portable (ext2) standalone backup discs with FreeNAS

Requirements:

  • stick a single 3.5" hdd into an external dock (usb) and be able to copy files to it
  • disc should be ext2 formatted so it can be transferred between devices (as opposed to tied to ZFS / UFS)
  • commands should all be run from FreeNAS shell (i.e. no external dependencies)

Partition and fix drive

Use these commands if you need to format the drive / change partitions.

Partition

@darth-veitcher
darth-veitcher / proxmox.md
Last active January 5, 2024 00:10
Proxmox setup and notes (Community Edition)

Install instruction and notes for setting up a homelab proxmox cluster

Updated as at June 2016 for Proxmox Virtual Environment 4.2-11/2c626aa1

Allow use of community packages

Change the apt sources to point to the community repo. Thanks to niccolox.org

# disable the enterprise repo
sed -i.bak s'/deb/# deb/' /etc/apt/sources.list.d/pve-enterprise.list
@darth-veitcher
darth-veitcher / pve-community.list
Created June 7, 2016 14:55
Promo Community Repo
# PVE pve-no-subscription repository provided by proxmox.com, NOT recommended for production use
# Accurate as at Proxmox Virtual Environment 4.2-11/2c626aa1
deb http://download.proxmox.com/debian jessie pve-no-subscription
@darth-veitcher
darth-veitcher / cloudflare-update-record.sh
Created July 31, 2016 15:03 — forked from benkulbertis/cloudflare-update-record.sh
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="[email protected]"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="example.com"
record_name="www.example.com"
# MAYBE CHANGE THESE
ip=$(curl -s http://ipv4.icanhazip.com)
@darth-veitcher
darth-veitcher / custom-styles-nuke.vb
Created December 6, 2016 08:24
Delete non-standard styles in target Excel workbook but keep custom styles from host
' Merges styles from Team FP&A into active workbook and deletes all other custom styles
Sub Merge_Styles()
If ActiveWorkbook.Path <> ThisWorkbook.Path Then ' cant be the same file...
Application.EnableEvents = False
Application.DisplayAlerts = False
On Error Resume Next
' Clear existing custum styles
Dim mpStyle As Style
For Each mpStyle In ActiveWorkbook.Styles
matched = False
@darth-veitcher
darth-veitcher / openvpn_over_tor_tails.sh
Created December 21, 2016 13:52
OpenVPN over Tor on Tails 2.4.x
########################
# OpenVPN over Tor
# made for Tails 2.4.x
########################
#check necessary rights
if [ ! `id -u` = 0 ] ; then
echo "This script needs to be run using 'sudo SCRIPT' or in 'root terminal'"
echo "exiting now"
exit
fi
@darth-veitcher
darth-veitcher / forwarding-index.html
Created December 27, 2016 23:15
Forwarding index.html
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="1; url=static/index.html">
<script>
window.location.href = "static/index.html"
</script>
@darth-veitcher
darth-veitcher / build-site.sh
Last active December 28, 2016 21:58
Ghost build script
#!/bin/sh
site='jamesveitch.com'
branch=$(git branch | awk '/\*/ {print $2}') # get the current branch
buster generate
# Remove static folder but ensure we delete stale files and keep the key
# CNAME and build-site.sh files
rsync -rLvP static/* . --delete-after --remove-source-files --exclude CNAME --exclude build-site.sh
rm -rf static
@darth-veitcher
darth-veitcher / emby-crontab.sh
Last active December 28, 2016 12:45
automate emby upgrading
# Automates a check once a week for new version of Emby on Ubuntu
# Saves having to do this manually when iOS App stops working
# Runs at 0205 every 4th day of week
5 2 * * 3 service emby-server stop && apt-get update && apt-get install -y emby-server && service emby-server start