Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
 

Stuart Axon stuaxo

💭
 
View GitHub Profile
@stuaxo
stuaxo / 70-snap.core.rules.d
Created Aug 31, 2021
70-snap.core.rules.d
View 70-snap.core.rules.d
# This file is automatically generated.
# Concatenation of all ModemManager udev rules
# do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_cinterion_port_types_end"
SUBSYSTEM!="tty", GOTO="mm_cinterion_port_types_end"
ENV{ID_VENDOR_ID}!="1e2d", GOTO="mm_cinterion_port_types_end"
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"
@stuaxo
stuaxo / cairo-svg-how-to-fill-and-stroke.ipynb
Last active Mar 24, 2021
OPERATOR_SOURCE and OPERATOR_CLEAR create images in SVGs
View cairo-svg-how-to-fill-and-stroke.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stuaxo
stuaxo / shoebot design notes.md
Last active Mar 14, 2021
Shoebot design notes.
View shoebot design notes.md
@stuaxo
stuaxo / aborting_transaction.py
Last active Jan 12, 2021
Aborting transaction context manager.
View aborting_transaction.py
"""
Aborting transaction context manager, useful for when prototyping on Django.
"""
from contextlib import contextmanager
from django.db import transaction
class AbortTransaction(Exception):
pass
@contextmanager
@stuaxo
stuaxo / cairo-test-output-windows-vs-2017.txt
Last active Nov 19, 2020
Cairo tests - Windows x64 - (under meson dist) - VS2017
View cairo-test-output-windows-vs-2017.txt
The Meson build system
Version: 0.55.3
Source dir: C:\Users\Stu\Desktop\projects\external\cairo\build\meson-private\dist-unpack\cairo-1.17.3
Build dir: C:\Users\Stu\Desktop\projects\external\cairo\build\meson-private\dist-build
Build type: native build
WARNING: Unknown options: "c_args, c_link_args, c_winlibs, cpp_args, cpp_eh, cpp_link_args, cpp_rtti, cpp_std, cpp_winlibs"
The value of new options can be set with:
meson setup <builddir> --reconfigure -Dnew_option=new_value ...
Project name: cairo
Project version: 1.17.3
@stuaxo
stuaxo / csv_to_xlsx.py
Created Oct 12, 2020
CSV to XLSX converter with XLSXWriter
View csv_to_xlsx.py
# csv_to_xlsx [filename... [filename]]
import csv
import os
import sys
import xlsxwriter
from pathlib import Path
def main(csv_filenames):
if non_files:
@stuaxo
stuaxo / build-pycairo.sh
Created Aug 13, 2020
Script to attempt to build pycairo
View build-pycairo.sh
set -ex
cd pycairo
PATH=$PATH:/c/ProgramData/chocolatey/bin:/c/ProgramData/chocolatey/tools
export CAIRO_VERSION=1.17.2
mkdir -p builds
function do_builds() {
bash -c .travis/runPyCairox64.sh
@stuaxo
stuaxo / class_repr.py
Created Jul 22, 2020
Python class repr that outputs class members.
View class_repr.py
def class_repr(self):
"""
Default class repr that outputs the content of a class.
Usage:
>>> class A:
... __repr__ = class_repr
...
@stuaxo
stuaxo / clone-cloudfoundry-s3-to-django-media-dir.sh
Created May 20, 2020
Clone s3 bucket to local django media directory
View clone-cloudfoundry-s3-to-django-media-dir.sh
#!/bin/bash
PROJECT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
DEFAULT_MEDIA_DIR=../config/media
# You *really* want to use this via clone-site.sh so that the database matches,
# but it's up to you.
set -e
usage() {
>&2 echo 'Usage: $ clone-bucket.sh cf-app [media directory]'
@stuaxo
stuaxo / dump-cloudfoundry-db.dh
Created May 20, 2020
Dump cloudfoundry database of current site
View dump-cloudfoundry-db.dh
#!/bin/bash
set -e
# software requirements:
# awk, jq, pg_dump, psql
# cloudfoundry cli (cf)
# post
# prerequisite:
# empty postgres database named invest-dev