Skip to content

Instantly share code, notes, and snippets.

View alexjj's full-sized avatar

Alex Johnstone alexjj

View GitHub Profile
@alexjj
alexjj / ZFS Snapshot Deletion
Created April 15, 2015 17:09
Delete all ZFS Snapshots
zfs list -H -o name -t snapshot | xargs -n1 zfs destroy
@alexjj
alexjj / grid-experiment-no-6.markdown
Created May 20, 2022 22:22
Grid Experiment No. 6
@alexjj
alexjj / jail.sh
Created September 10, 2017 14:54 — forked from paulc/jail.conf
FreeBSD ZFS Jail
#!/bin/sh
[ -z "${DEBUG}" ] || set -x
ZPOOL=${ZPOOL:-zroot}
JAIL_ROOT=${JAIL_ROOT:-/jail}
JAIL_RELEASE=${JAIL_RELEASE:-$(sysctl -n kern.osrelease | sed -e 's/-p[0-9]*$//')}
JAIL_ARCH=${JAIL_ARCH:-$(sysctl -n hw.machine_arch)}
JAIL_DIST=${JAIL_ROOT}/dist/${JAIL_RELEASE}
JAIL_TEMPLATE=${JAIL_ROOT}/template/${JAIL_RELEASE}/root
@alexjj
alexjj / docker-compose.yml
Created November 29, 2019 19:55
Sample docker-compose with Traefik v2.0 and Lets Encrypt
version: "3.7"
services:
bitwarden:
image: bitwardenrs/server:latest
container_name: bitwarden
volumes:
- /home/alex/docker/bitwarden:/data
restart: unless-stopped
environment:
@alexjj
alexjj / opml-to-md-files.py
Created December 6, 2021 12:38
Converts drummer opml file to series of markdown files based upon date
import pathlib
from datetime import datetime
from xml.etree import ElementTree
def process_date(date):
"""
Converts opml created date into python datetime object
"""
datetime_object = datetime.strptime(date, '%a, %d %b %Y %H:%M:%S %Z')
return datetime_object
Sub PasswordBreaker()
'Breaks worksheet password protection.
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
@alexjj
alexjj / fetch_stock_prices_for_gnucash.py
Created January 7, 2019 06:01 — forked from rgreen13/fetch_stock_prices_for_gnucash.py
Python script to fetch stock prices for gnucash using http://alphavantage.co/ api. Since Quotes::Finance fetching from Yahoo finance no longer works, it is an alternative.
# INSTALL DEPENDENCIES BEFORE RUNNING: pandas, sqlite3, sqlalchemy, requests
# There is one thing you have to do though: gnucash needs to know the price's currency and it needs a guid (unique identifier)
# for this. This guid is unique for each installation, so you need to find yours and assign it to CURRENCY_GUID.
# OR: you can just leave it, and the script will fetch the currency from the last price added
import pandas as pd
import sqlite3
import sqlalchemy
from sqlalchemy import create_engine
import time
@alexjj
alexjj / Swap sign in qif
Last active August 14, 2016 21:49
Switch sign in bank qifs to fix import errors with YNAB
import sys
def main(argv):
for inFilename in argv:
if not inFilename.endswith('.qif'):
print "Error: expected QIF file"
raw_input("Press enter to get outa here...")
return 1
outFilename = inFilename.replace('.qif', '.negated.qif')
@alexjj
alexjj / bean-report.md
Created March 11, 2016 20:03
Help output of bean-report

Reports

Generated with bean-report FILENAME.beancount {report name}

Reports:

balances,bal,trial:
    Print out the trial balance of accounts matching an expression.
balsheet:
    Print out a balance sheet.
#This script allows an EncFS password to be stored in KDE’s kwallet. This is useful for anyone who has encrypted parts of their #harddrive and want them to be automatically mounted when logging on to KDE. On the first run, a dialogue will allow the password #to be stored in kwallet; subsequently, the kwallet password will be requested (if kwallet is not already authenticated) and then #the encrypted directory will be automatically mounted. The script has not been tested on recent versions of KDE, but it is known #to have worked in versions 4.2 and 4.3.
#Usage
#kdeencfs ROOTDIR MOUNTPOINT
#The call to kdeencfs can be placed in a file located in ~/.kde/Autostart:
# mount my private directories
kdeencfs /home/ben/.private /home/ben/private
kdeencfs /mnt/data/.secret /home/data/secret