Skip to content

Instantly share code, notes, and snippets.

View matthew-macgregor's full-sized avatar
🏠
Working from home

Matthew MacGregor matthew-macgregor

🏠
Working from home
View GitHub Profile
@matthew-macgregor
matthew-macgregor / smartquotes.py
Last active April 25, 2023 05:15 — forked from davidtheclark/dumb_to_smart_quotes.py
Convert dumb quotes to smart quotes in Python
#!/usr/bin/env python3
"""
Inspired by : https://gist.github.com/davidtheclark/5521432
Converts dumb quotes to smart quotes, -- to EM_DASH and ... to ELLIPSES.
"""
import sys
import re
import os
@matthew-macgregor
matthew-macgregor / Install.md
Last active December 8, 2021 05:12
Digispark + Arduino Setup: Fedora 35

Digispark + Arduino Setup on Fedora 35

I encountered some challenges getting up and running with my Digispark ATTINY85 Micro USB dev board on Fedora 35, so I thought I would document it before I forget. The board was a few dollars and similar to this one:

https://www.amazon.com/Digispark-Kickstarter-ATTINY85-Arduino-Development/dp/B01MQOPY5C

The problems I encountered:

  • The board uses the micronucleus bootloader https://github.com/micronucleus/micronucleus, which frees up pin 6 (RESET) for use but means I can't use the usual serial programmer. The instructions are for the Arduino IDE.
  • Arduino IDE no longer has a package maintainer on Fedora 35, so I couldn't install from the official repositories. It's available as a snap or flatpak, but I would prefer to install from the website.
@matthew-macgregor
matthew-macgregor / index.html
Created May 25, 2021 17:52
Starter HTML Template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<meta name="description" content="Description">
<meta name="author" content="Author">
<link rel="stylesheet" href="css/main.css">
</head>
@matthew-macgregor
matthew-macgregor / cloud-config.yaml
Last active July 19, 2020 18:44
Jekyll Install / Ubuntu 20.04
#cloud-config
package_update: true
package_upgrade: true
#cloud-config
packages:
- ruby-full
- build-essential
- zlib1g-dev
@matthew-macgregor
matthew-macgregor / ornament_order.json
Last active August 6, 2019 22:27
WHCC Ornament Order
{
"EntryID": 180767,
"Orders": [
{
"DropShipFlag": 1,
"FromAddressValue": 2,
"BackWriting": "SXYDNACG",
"OrderAttributes": [{ "AttributeUID": 96 }, { "AttributeUID": 545 }],
"OrderItems": [
{
@matthew-macgregor
matthew-macgregor / hide-admin.php
Created December 19, 2016 02:43
Hide the admin panel from users without certain capabilities.
<?php
/**
* Disable admin bar on the frontend of your website
* for subscribers.
*/
function themeblvd_disable_admin_bar() {
if ( ! current_user_can('edit_posts') ) {
add_filter('show_admin_bar', '__return_false');
}
@matthew-macgregor
matthew-macgregor / ajaxy.php
Created December 19, 2016 02:42
A couple of quick WP-Ajax examples.
<?php
/*
Plugin Name: Ajax Demo
Plugin URI:
Description: Yes, this is an ajaxy plugin.
Author: Matsuzine
Version: 1.0
Author URI:
*/
@matthew-macgregor
matthew-macgregor / calibre-install.sh
Last active December 28, 2015 05:29
Alternate Calibre Install.sh for Linux
#/bin/bash
# Description
# ----------------------------------------------------------------------
# Installs the binary of the Calibre ebook software on Linux.
# https://github.com/kovidgoyal/calibre
#
# Tested only on Ubuntu version 15.10. If you run this on another
# version of Linux, let me know the results!
#
@matthew-macgregor
matthew-macgregor / MainActivity.java
Created November 14, 2015 06:36
Android Volley Example (for Stackoverflow issue 33686054)
package com.example.matthew.testvolleypost;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;