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 / 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 October 27, 2021 06:32
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 November 4, 2024 20:29
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.
@MichaelCurrin
MichaelCurrin / README.md
Last active October 22, 2021 10:25
Open Repo shell tool

Open Repo shell tool

Open the current git repo directory on GitHub in your default browser.

Run this in a directory within a local git repo. The directory will be opened in your browser such as on GitHub.

Features

  • Works for any user or org, as long as .git directory exists at some level.
  • Recognizes subdirectories.
@MichaelCurrin
MichaelCurrin / install-jekyll.md
Last active April 22, 2022 23:14
Install Jekyll

Install Jekyll

Prerequisites - install Ruby and Bundler globally for your user.

Install Jekyll in a project

Jekyll 3.9

This is the version that runs on GH Pages.