Skip to content

Instantly share code, notes, and snippets.

View james2doyle's full-sized avatar

James Doyle james2doyle

View GitHub Profile
@james2doyle
james2doyle / bitbucket-pipelines.yml
Created February 14, 2023 21:38
Bitbucket pipeline file for building Android app apk files with Flutter
# You can run the pipeline image locally using the following command:
# docker run --platform linux/amd64 -it --volume="$PWD:/app" --workdir="/app" --entrypoint=/bin/bash avetkhov/flutter:latest
definitions:
caches:
pub: ~/.pub-cache # $PUB_CACHE default value
flutter: /opt/flutter # flutter sdk path
steps:
- step: &flutter-run
name: Flutter Test
@james2doyle
james2doyle / flutter.sublime-build
Created January 25, 2023 18:56
Flutter Sublime Text 3 build helpers
{
"cmd": ["flutter", "run", "--hot"],
"selector": "source.dart",
"working_dir": "$project_path",
"variants": [
{
"name": "Flutter - Format File",
"cmd": ["dart", "format", "$file"]
},
{
@james2doyle
james2doyle / flutter.sublime-project
Last active January 25, 2023 19:42
Flutter Sublime Text project file that includes some build system helpers
{
"folders": [
{
"path": ".",
"folder_exclude_patterns": [
".dart_tool",
"build",
"web",
"windows",
"linux",
@james2doyle
james2doyle / docker-compose.yml
Created December 8, 2022 00:04
A docker compose file for payload CMS that includes a setup of inbound to catch emails
# `npx create-payload-app` with a project called `demo`
version: '3'
services:
payload:
image: node:18-alpine
ports:
- "3000:3000"
volumes:
- ./demo:/home/node/app
@james2doyle
james2doyle / docker-compose.yml
Last active December 19, 2022 21:03
Run inbucket locally in Docker to capture and debug emails without sending them
# docker run -d --name inbucket -p 9000:9000 -p 2500:2500 -p 1100:1100 inbucket/inbucket
# open http://localhost:9090/
version: '3.8'
services:
inbucket:
container_name: inbucket
image: inbucket/inbucket:3.0.3
ports:
- '2500:2500' # SMTP
@james2doyle
james2doyle / console.php
Last active November 23, 2022 19:45
Console command to generate a valid session cookie for a authenticated user in a Laravel app
<?php
declare(strict_types=1);
use App\Models\User;
use Illuminate\Support\Facades\Artisan;
use Symfony\Component\HttpFoundation\Cookie;
use Illuminate\Cookie\CookieValuePrefix;
Artisan::command('user-cookie', function (): void {
@james2doyle
james2doyle / auto-correct.yml
Created August 26, 2022 23:10
Espanso match files for text faces and common misspellings
# espanso match file
# For a complete introduction, visit the official docs at: https://espanso.org/docs/
# You can use this file to define the base matches (aka snippets)
# that will be available in every application when using espanso.
# Matches are substitution rules: when you type the "trigger" string
# it gets replaced by the "replace" string.
matches:
@james2doyle
james2doyle / Touchpad.lua
Created August 15, 2022 17:14
A Hammerspoon script that allows actions to be bound to quadrants on the trackpad
--[[
Name: Touchpad Control
Author: James Doyle <james2doyle@gmail.com>
Description: Hook into events/gestures that are triggered on the trackpad
Installation: Just require this file in your Hammerspoon init.lua file
Usage:
Bind the click actions or swipe actions to events
]]--
local trackpad_actions = {}
@james2doyle
james2doyle / rules.txt
Last active November 21, 2023 17:39
Some ublock rules that block elements that match specific pieces of text
! 2022-03-24 https://twitter.com
twitter.*##div[aria-label="Timeline: Trending now"]
twitter.*##div[aria-label="Home timeline"] > div > div article:has(div > div > div > span:has-text(Ad))
! 2022-03-29 https://google.com
google.*##.g:has(a[href*="thetopsites.com"])
google.*##.g:has(*:has-text(/bye topic of noninterest/i))
@james2doyle
james2doyle / main.py
Last active July 18, 2022 17:25
An ESP32 script that connects to WIFI and starts a UDP server
import network
import utime
import socket
import machine
p2 = machine.Pin(2, machine.Pin.OUT) # create input pin on GPIO2 (builtin LED)
p2.off()
def toggle_pin():
p2.value(1) if p2.value() == 0 else p2.value(0)