Skip to content

Instantly share code, notes, and snippets.

View miclgael's full-sized avatar
🐱
Looking at pictures of my cats

Michael Gale (he/him) miclgael

🐱
Looking at pictures of my cats
View GitHub Profile
@ayoayco
ayoayco / gh-alerts.md
Created December 14, 2023 12:16
GH Alerts in MD files

Note

Highlights information that users should take into account, even when skimming.

Tip

Optional information to help a user be more successful.

Important

Crucial information necessary for users to succeed.

[!WARNING]

@tigt
tigt / git-branch-to-favicon.js
Created March 18, 2020 21:10
Creates an SVG string that can be used as a favicon across different Git branches. Actually getting this into the browser is sadly project-specific.
const { execSync } = require('child_process')
const { createHash } = require('crypto')
const invertColor = require('invert-color')
const branchName = execSync('git rev-parse --abbrev-ref HEAD')
const hash = createHash('sha256')
hash.update(branchName)
const color = '#' + hash.digest().toString('hex').substring(0, 6)
const invertedColor = invertColor(color, true)
@jotazzu
jotazzu / edit-screen.php
Last active December 19, 2019 23:59
Replaces deprecated calls to create_function() in WordPress plugin Tabify Edit Screen with anonymous function definitions. See https://wordpress.org/support/topic/another-patch-create_function-is-deprecated-since-php-7-2/
<?php
/**
* //JT 13.12.19: create_function() is deprecated.
*/
include 'tabs.php';
class Tabify_Edit_Screen_Edit_Screen {
@Sacristan
Sacristan / push_commits_by_chunks.sh
Last active April 6, 2024 15:14
Push commits by chunks
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=10
# check if the branch exists on the remote
# if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# # if so, only push the commits that are not on the remote already
# range=$REMOTE/$BRANCH..HEAD
# else
# # else push all the commits
function squarify (children, row, width) {
if (children.length === 1) {
layoutLastRow(row, children, width)
return
}
const rowWithChild = [...row, children[0]]
if (row.length === 0 || worst(row, width) >= worst(rowWithChild, width)) {
@clementbat
clementbat / treemap-algorithm
Created February 26, 2019 11:13
treemap algorithm
procedure squarify(list of real children, list of real row,real w)
begin
real c = head(children);
if worst(row, w) ≤ worst(row++[c], w) then
squarify(tail(children), row++[c], w)
else
layoutrow(row);
squarify(children, [], width());
fi
end
@ayoayco
ayoayco / update-commits
Created October 19, 2018 03:46
update author info in git commits
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="mail@ayoayco.com"
CORRECT_NAME="Ayo"
CORRECT_EMAIL="ramon.aycojr@gmail.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@benjamineskola
benjamineskola / evening.applescript
Last active November 30, 2022 09:57
Automatically set repeating tasks tagged ‘Evening’ to be done this evening, in Things 3 — updated versions here: https://github.com/benjamineskola/things-scripts/blob/master/evening.applescript
-- run first thing in the morning, e.g., from cron
tell application "Things3"
set theToken to "your-auth-token"
set theTodos to to dos of list "Today"
repeat with aTodo in theTodos
set tagList to tags of aTodo
repeat with aTag in tagList
if (name of aTag as text) is "Evening"
@kizzx2
kizzx2 / docker-compose.yml
Last active May 6, 2024 02:48
Restart a docker container periodically with docker-compose
version: '3'
services:
app:
image: nginx:alpine
ports: ["80:80"]
restart: unless-stopped
restarter:
image: docker:cli
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
@troyfontaine
troyfontaine / 1-setup.md
Last active May 3, 2024 10:52
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.