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 / pgcr-4619050604.json
Created September 7, 2019 15:13
pgcr-4619050604.json
{
"ErrorCode": 1,
"ErrorStatus": "Success",
"Message": "Ok",
"MessageData": {},
"Response": {
"activityDetails": {
"directorActivityHash": 2122313384,
"instanceId": "4619050604",
"isPrivate": false,
@darth-veitcher
darth-veitcher / install-docker-compose.sh
Created September 5, 2019 22:02
Install docker-compose on CoreOS
#!/bin/bash
# needs to be run with sudo permissions
mkdir -p /opt/bin
LATEST_URL=`curl -Ls -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest`
COMPOSE_VERSION=${LATEST_URL##*/}
DOWNLOAD_URL=https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m`
curl -L ${DOWNLOAD_URL} -o /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
@darth-veitcher
darth-veitcher / self-signed.sh
Created November 8, 2018 22:54
Create Self-signed Certs
#!/bin/sh
# one-liner to quickly generate certs
# props to StackOverflow (as always)
# https://stackoverflow.com/a/51417561
# and
# https://www.shellhacks.com/create-csr-openssl-without-prompt-non-interactive/
# (note use of * for wildcard)
# https://github.com/wekan/wekan/wiki/Traefik-and-self-signed-SSL-certs
# https://crypto.stackexchange.com/questions/26591/tls-encryption-with-a-self-signed-pki-and-python-s-asyncio-module
# https://jimfrenette.com/2018/03/ssl-certificate-authority-for-docker-and-traefik/
@darth-veitcher
darth-veitcher / local-gitbook.md
Created December 28, 2017 14:36
Using gitbook locally notes
@darth-veitcher
darth-veitcher / gitbook-to-github.md
Created December 28, 2017 12:35
publish from gitbook to github.com

Quick note to self about how to connect a gitbook to a github.com repository. I'm using the GitBook Editor but this will also work for a terminal.

Essentially you need to create a personal access token (found in the Developer section of your profile settings) and grant the token the ability to connect to and control repositories. This then gets prefixed to your https:// origin in the manner username:token@.

See below screenshots:

Personal Access Tokens


Grant Scope for Repos


The Token


Add Prefix

@darth-veitcher
darth-veitcher / amazon-alexa-setup.md
Created December 17, 2017 20:04
Amazon Alexa setup
@darth-veitcher
darth-veitcher / random-useful-terminal-commands.md
Last active December 4, 2017 18:00
random useful terminal commands

Get the lastest version of a git repository

# Initialise empty repo and set remote
# (this way we can only download tags not whole repo)
git init
git remote add origin https://github.com/my/repo.git

# Get new tags from the remote
git fetch --tags
@darth-veitcher
darth-veitcher / docker-on-proxmox.md
Created December 2, 2017 21:05
running docker inside lxc container on proxmox

Docker install notes

Source: Docker install

Proxmox: Need to add lxc.aa_profile = unconfined, security.privileged = true and lxc.cap.drop = into the container config in /etc/pve/lxc/ per forums and here.

sudo apt-get update

The below will fail if running on ProxMox due to specific kernel

@darth-veitcher
darth-veitcher / jupyter-notebook-cheatsheet.md
Last active November 25, 2017 13:57
Jupyter notebook cheatsheet for Data Science

Jupyter notebook cheatsheet

Hints and tips for Data Science usage

Export to static html file

Useful for saving a workbook to a static html file that can then be presented back afterwards.

%%bash
jupyter nbconvert --to html 'mynotebook.ipynb'
@darth-veitcher
darth-veitcher / useful-linux-filesystem-commands.md
Created October 27, 2017 08:00
useful linux filesystem commands
# Archive content which hasn't been modified within the last 6months
find . -mtime +180 | while read -r name; do rsync -rLvPz --remove-source-files "$name" rsync://homenas/Backups/hd/; done

# Delete folders which have contents < 50kb
find /path/to/root/folder -mindepth 1 -maxdepth 1 -type d -exec du -ks {} + | awk '$1 <= 50' | cut -f 2- | xargs -d \\n rm -rf