Skip to content

Instantly share code, notes, and snippets.

View MichaelCurrin's full-sized avatar

Michael Currin MichaelCurrin

  • The Netherlands
View GitHub Profile
@MichaelCurrin
MichaelCurrin / install-poetry.md
Last active December 25, 2024 18:47
Install Poetry

Install Poetry

See Installation in the Poetry website.

Alternatives:

  • General. Run this outside a virtual env. Note pipx is preferred so use it if you have it.
    $ pip install poetry

$ pipx install poetry

@MichaelCurrin
MichaelCurrin / install-python-linux.md
Last active December 23, 2024 08:17
Install Python on Linux distros

Debian/Ubuntu

Install using apt-get. sh $ sudo apt-get update $ sudo apt-get install python3 # OR python3.12

Warning: Note that for Debian, the major Python versions available are locked within a Debian release version. Therefore you must upgrade to a newer OS version to get a newer Python version. Or install Python from a different repository or build from source, but this is a custom installation which may be hard to get working or maintain, so I don't recommend it. For instance, when you install C headers or choose a Python version for your IDE, you system will not by default know to look in the custom location you've installed Python to. Using pyenv might make this easier though

@MichaelCurrin
MichaelCurrin / README.md
Last active February 23, 2023 12:41
Increment and create a Git tag based on whether [MAJOR] or [MINOR] appears in the current commit message

Setup

If you make the script executable and in your bin directory, you can run it from anywhere.

$ chmod +x commit_msg_tag.sh
$ sudo mv commit_msg_tag.sh /usr/local/bin/commit_msg_tag

Then run as:

@MichaelCurrin
MichaelCurrin / install-geckodriver.md
Last active January 6, 2025 12:59
Install Geckodriver

Install Rust

From the Install doc:

  • Unix (macOS and Linux)
    $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    $ # Previously the guide just said this:
    $ curl https://sh.rustup.rs -sSf | sh
@MichaelCurrin
MichaelCurrin / README.md
Last active February 13, 2025 12:05
VS Code snippets
@MichaelCurrin
MichaelCurrin / README.md
Last active September 25, 2024 05:36
Raspberry Pi Servo

Raspberry Pi Servo

How to control a 9G servo motor with a Rasp Pi and a simple Python script

Resources

The use of the servo including the wiring and script is based on this YouTube tutorial - Raspberry Pi Servo Motor Control. There are also plenty of similar videos out there.

For Arduino, see Using Servo Motors with Arduino

@MichaelCurrin
MichaelCurrin / README.md
Last active December 24, 2022 23:52
GitHub GraphQL - Get repos for a target GH user or org
@MichaelCurrin
MichaelCurrin / README.md
Last active January 16, 2023 15:37
Python example - convert text to JSON structure #python #json

Python example - convert text to JSON structure

The Python script below demonstrates how to use regex to match on text with a known structure to build a dictionary, then convert the output to JSON data.

The task comes from this StackOverflow question.

Rather than using a procedural approach to handle the lines one at a time and extract the relevant items, I split the text into chunks and then dealt with each using regex pattern to extract the relevant pieces. Expecting questions A and B to always be present and C and D to be there sometimes.

Note use brackets for capture groups.

@MichaelCurrin
MichaelCurrin / twitter-api-tokens.md
Last active December 24, 2022 23:55
Twitter API tokens for a new account

Twitter API tokens

How to set up a Twitter dev account, register Twitter app and generate Twitter API tokens

This guide takes you through setting up a new Twitter account all the way through to generated Twitter auth tokens (aka API tokens or credentials). These tokens must be used on every request, such as fetch or create Twitter content.

Overview

  1. Register a Twitter account.
  2. Apply for a Twitter developer account.