Skip to content

Instantly share code, notes, and snippets.

View breadthe's full-sized avatar

breadthe

View GitHub Profile
@breadthe
breadthe / Release golang apps using Github Actions.md
Created February 7, 2024 07:00 — forked from danawoodman/Release golang apps using Github Actions.md
Create a Go app release for every git version tag using Github Actions

Release golang apps using Github Actions

Want to release a new binary on Github for every new git tag (e.g. v1.2.7)? Here is a simple Github Actions yaml config file that should get you started.

This script will automatically checkout your code, setup the correct version of go as defined in your go.mod file and build your go binary (in this case using a Makefile default target), then upload it to a new Github Release.

# .github/workflows/release.yml
name: Build and release Go Project
@breadthe
breadthe / seismic-v1.2.0-update.json
Last active March 6, 2023 21:32
Seismic v1.2.0 update
{
"version": "1.2.0",
"notes": "Features: tsunami warning, open events on earthquake.usgs.gov, Windows & Linux builds.",
"pub_date": "2023-03-03T03:43:39.322Z",
"platforms": {
"darwin-x86_64": {
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVTRGQ4NVZVdDdlRnZvdGFIelZQbW9qcTRyd3B3Vis4Q1YwOUNjYWl4U2JGTzBWNWpRaXR6MndBanFhL2w3dysxbXRZcmV2aFhvTklNd3EwOUR4YXEvRjVuQncrZEMvaXdrPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNjc3ODA3NzU5CWZpbGU6c2Vpc21pYy5hcHAudGFyLmd6CmpNZXJ0ZUdXckNadm1kdU5yRUZkRWZKWFdSRTh1S1RmNFcvUElQQnVFbFc4M1FrUWpsaHpUNGtKdk1oSWJ5NENlendGNmxMNEFWTVRmVUlmMzJYQUNRPT0K",
"url": "https://github.com/breadthe/seismic/releases/download/v1.2.0/seismic.app.tar.gz"
},
"darwin-aarch64": {
@breadthe
breadthe / seismic-update.json
Last active February 14, 2023 08:34
Seismic update.json
{
"version": "1.0.2",
"notes": "1.0.2 update",
"pub_date": "2023-02-13T21:42:04.140Z",
"platforms": {
"darwin-x86_64": {
"signature": "",
"url": "https://github.com/breadthe/seismic/releases/download/v1.0.2/seismic.app.tar.gz"
},
"darwin-aarch64": {
@breadthe
breadthe / Bytes.php
Created January 10, 2023 16:34 — forked from inxilpro/Bytes.php
<?php
namespace App\Support;
use InvalidArgumentException;
class Bytes
{
// Most modern systems use base-1000 rather than base-1024 for file size now
protected const BASE = 1000;
@breadthe
breadthe / txt2img.py
Last active July 29, 2023 20:00
Save image generation parameters into textfile along with the generated image + disable safety check
import argparse, os, sys, glob
import cv2
import torch
import numpy as np
from omegaconf import OmegaConf
from PIL import Image
from tqdm import tqdm, trange
from imwatermark import WatermarkEncoder
from itertools import islice
from einops import rearrange
@breadthe
breadthe / sd.sh
Created September 2, 2022 17:56
Stable Diffusion prompt script
#!/bin/bash
echo -n "Enter a prompt: "
read prompt
echo -n "Steps (default 10): "
read steps
if [[ -z "$steps" ]]; then
steps=10
@breadthe
breadthe / app.js
Last active April 11, 2022 12:58
Alpine.js + Blade copy to clipboard button
<!--
resources/js/app.js
Put this code at the bottom of `app.js`
OR
Put it in a `clipboard.js` file and import it in `app.js` with:
require('./clipboard');
-->
window.initClipboard = () => {
@breadthe
breadthe / Log.php
Created April 2, 2022 21:56
Barebones PHP error logging class
<?php
// src/Log.php
namespace App;
/**
* Barebones error logging class
*
* Location: <project root>/src/Log.php
*
* Usage:
@breadthe
breadthe / formatBytes.php
Created November 25, 2021 18:14
Format bytes to human readable (KB/MB/GB)
<?php
/**
* Put this in bootstrap/helpers.php
* Add "files" key in composer.json > autoload: "files": ["bootstrap/helpers.php"]
* @see https://stackoverflow.com/questions/2510434/format-bytes-to-kilobytes-megabytes-gigabytes
*/
function formatBytes(int $bytes, $precision = 2)
{
$units = ['B', 'KB', 'MB', 'GB', 'TB'];
@breadthe
breadthe / version.blade.php
Last active December 28, 2022 10:31
Display app git tag & commit hash in a Laravel app
// resources/views/app/version.blade.php
<div>
<span>{{ config('version.string') }}</span>
<span>&mdsh;</span>
<span>{{ config('app.env') }}</span>
<span>&mdash;</span>
<span>{{ 'Laravel ' . app()->version() }}</span>
<span>&mdash;</span>
<span>{{ app()->getLocale() }}</span>