Skip to content

Instantly share code, notes, and snippets.

@cas--
cas-- / .gitconfig
Created April 19, 2024 15:00
Common Git Aliases
[alias]
b = branch
br = branch
ci = commit
ci-aa = commit --am -a
ci-f = "!git commit --fixup=$1 $2 #"
ci-s = "!git commit --squash=$1 #"
co = checkout
cob = checkout -b
chp = cherry-pick
@cas--
cas-- / uk_bbox_example.py
Created December 21, 2023 14:23
Satellite data example
import pandas as pd
import requests
from shapely.geometry import box
start_date = "2022-06-01"
end_date = "2022-06-10"
data_collection = "SENTINEL-1"
# http://bboxfinder.com/#49.693397,-5.862579,50.839769,-4.107513
shapely_polygon = box(-5.862579, 49.693397, -4.107513, 50.839769)
@cas--
cas-- / gist:8e55d01a897500f836e010f0ad858f41
Created July 6, 2023 21:48
Vorta for Borg Exclude Patterns
# Exclude caches
**/.cache
**/cache
~/.thumbnails
**/.DS_Store
**/Thumbs.db
~/.wget-hsts
# Mounted file system
OFFSET = 127462 - ord('A')
def unicode_flag_to_country_code(code_points: list) -> str:
"""Converts unicode emoji flag to country code string
Args:
code_points: A list of unicode code points representing a
country flag
@cas--
cas-- / index.html
Created May 4, 2023 14:16
Text corruption on Linux Intel GPU
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'" />
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'" />
<link rel="stylesheet" href="styles.css">
<title>Linux Intel GPU rendering bug</title>

These steps will create a git alias command to parse a Jira issue reference from a branch and automatically append it to a commit message.

Create a Sureswift specific git config e.g. ~/sureswift/.gitconfig. The path will be the parent directory where you keep all the repositories e.g. ~/sureswift. Add your details and a 'jira' trailer for the Jira reference:

[user]
	name = Your Name
	email = your.name@sureswiftcapital.com
### Keybase proof
I hereby claim:
* I am cas-- on github.
* I am calumlind (https://keybase.io/calumlind) on keybase.
* I have a public key whose fingerprint is EA01 185D 0E8A A00D 6323 A308 9059 7A68 7B83 6BA3
To claim this, I am signing this object:
@cas--
cas-- / adventures-in-python-core-dumping.md
Created September 3, 2021 13:41 — forked from toolness/adventures-in-python-core-dumping.md
Adventures in Python Core Dumping

Adventures in Python Core Dumping

After watching Bryan Cantrill's presentation on [Running Aground: Debugging Docker in Production][aground] I got all excited (and strangely nostalgic) about the possibility of core-dumping server-side Python apps whenever they go awry. This would theoretically allow me to fully inspect the state of the program at the point it exploded, rather than relying solely on the information of a stack trace.

#!/usr/bin/env python3
#
# Copyright (c) 2021 Jasper Lievisse Adriaanse <j@jasper.la>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
@cas--
cas-- / win32_verstamp.py
Created September 21, 2018 15:40
Stamp windows exe files with version information
""" Stamp a Win32 binary with version information.
Original code from pywin32 module.
Modified to only use ctypes, making it standalone.
"""
import ctypes
import os
import struct
import glob