Skip to content

Instantly share code, notes, and snippets.

View JamesGardiner's full-sized avatar

James Gardiner JamesGardiner

View GitHub Profile
@JamesGardiner
JamesGardiner / rastermerege-rasterio,py
Created May 23, 2023 11:18 — forked from nishadhka/rastermerege-rasterio,py
Raster merge using rasterio
import rasterio.merge
bounds=None
res=None
nodata=None
precision=7
def merge(input1,bounds, res, nodata, precision):
import warnings
warnings.warn("Deprecated; Use rasterio.merge instead", DeprecationWarning)
@JamesGardiner
JamesGardiner / work-git-repo.sh
Created March 17, 2023 09:45
Set up local work config for Git
git config -f ~/.gitconfig-work user.email <your.work@email.com>
git config -f ~/.gitconfig-work user.signingkey <your.signing.key>
git config --global "includeIf.gitdir:~/work/.path" "~/.gitconfig-work"
@JamesGardiner
JamesGardiner / git-commit-template.md
Created October 30, 2022 08:31 — forked from lisawolderiksen/git-commit-template.md
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the

@JamesGardiner
JamesGardiner / flatten.py
Created July 29, 2021 08:14
Flatten dictionary
def flatten(data):
"""Flatten a nested dict.
Args:
data (dict): The dictionary to flatten
Returns:
dict: Flattened dictionary
"""
out = {}
#!/bin/sh
function install_wireguard () {
echo "Downloading Wireguard ($RELEASE)..."
FILENAME="wireguard-v2.0-$BOARD-$RELEASE.deb"
DEB_URL="https://github.com/Lochnair/vyatta-wireguard/releases/download/$RELEASE/$FILENAME"
if (/usr/bin/curl -s -L -o /tmp/$FILENAME $DEB_URL); then
echo "Installing $FILENAME..."
dpkg -i /tmp/$FILENAME
rm -f /tmp/$FILENAME
@JamesGardiner
JamesGardiner / hh-accomodation-eng-wls-changes.json
Created August 15, 2019 09:50
hh-accomodation-eng-wls-changes
{
"data_version": "0.0.3",
"description": "Census England Household Schema",
"hub": {
"enabled": true
},
"legal_basis": "Voluntary",
"metadata": [
{
"name": "user_id",
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
@JamesGardiner
JamesGardiner / day1_1.py
Last active December 3, 2018 09:27
AoC Day 1
with open("./day1_input.txt") as fp:
inputs = [int(line.strip("\n")) for line in fp.readlines()]
print(f"Answer: {sum(inputs)}")
@JamesGardiner
JamesGardiner / sdx-sm-repos.json
Last active May 10, 2018 08:32
List of SDX and SM repos
[
{
"repo": "sdx-ops",
"userName": "ONSDigital"
},
{
"repo": "sdx-evolution",
"userName": "ONSDigital"
},
{
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.