Skip to content

Instantly share code, notes, and snippets.

View freekrai's full-sized avatar

Roger Stringer freekrai

View GitHub Profile
@freekrai
freekrai / Readme.md
Last active October 29, 2023 17:31 — forked from AceCodePt/hx-astro-view-transition.js
htmx-astro-view-transition

Add it to the body

<body hx-ext="hx-astro-view-transition">

An example

@freekrai
freekrai / keybase.md
Created October 19, 2023 20:51
keybase.md

Keybase proof

I hereby claim:

  • I am freekrai on github.
  • I am zolomongrundi (https://keybase.io/zolomongrundi) on keybase.
  • I have a public key ASA2Q6OMJSsnkl9WjhSIfoTH9X_uz7ERBWtq4r7f5ZT2Ago

To claim this, I am signing this object:

@freekrai
freekrai / fasting.js
Last active February 15, 2023 00:43
Intermittent fasting timer widget for scriptable
/*
Copy this to scriptable
When creating a widget, add the hours you start fasts and eating time (ie 19:00,8:00)
Also set fastingInterval to the number of hours your eating time has.
*/
const canvSize = 282;
const canvTextSize = 40;
const canvas = new DrawContext();
canvas.opaque = false
@freekrai
freekrai / directus-example
Last active August 16, 2022 14:25
Shell script to download Directus examples from GitHub without having to clone entire repo
#! /usr/bin/env bash
if [ -z "$1" ]; then
echo USAGE: "$0" EXAMPLE
exit
fi
url="https://github.com/directus/examples/$1"
# default to branch master
branch=main
@freekrai
freekrai / dnsmasq OS X.md
Created July 20, 2021 16:39 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@freekrai
freekrai / V2.sql
Last active April 17, 2021 00:42 — forked from kez/slugify.sql
Generating Slugs in Postgres
CREATE EXTENSION IF NOT EXISTS "unaccent";
CREATE OR REPLACE FUNCTION slugify(t text) RETURNS text
AS $$
BEGIN
t := regexp_replace(t, '[Ää]', 'ae', 'g');
t := regexp_replace(t, '[Öö]', 'oe', 'g');
t := regexp_replace(t, '[Üü]', 'ue', 'g');
t := unaccent(t);
t := lower(t);
@freekrai
freekrai / browser-mockup.png
Created March 31, 2021 18:05 — forked from jarthod/browser-mockup.png
Pure CSS browser mockups
browser-mockup.png
@freekrai
freekrai / AuthyToOtherAuthenticator.md
Created March 31, 2021 17:38 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the

@freekrai
freekrai / log_js_errors.js
Created March 26, 2021 16:25 — forked from levelsio/log_js_errors.js
Log JS errors as a POST to your server
// <log errors to server>
window.onerror = function (messageOrEvent, source, lineno, colno, error) {
try {
console.log({
//error message(string).Available as event (sic!) in HTML onerror = "" handler.
messageOrEvent: messageOrEvent,
//URL of the script where the error was raised(string)
source: source,
//Line number where error was raised(number)