Skip to content

Instantly share code, notes, and snippets.

Avatar

Roger Stringer freekrai

View GitHub Profile
@freekrai
freekrai / fasting.js
Last active February 15, 2023 00:43
Intermittent fasting timer widget for scriptable
View fasting.js
/*
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
View directus-example
#! /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
View dnsmasq OS X.md

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

View ifttt-webhooks-extended-guide.md
@freekrai
freekrai / V2.sql
Last active April 17, 2021 00:42 — forked from kez/slugify.sql
Generating Slugs in Postgres
View V2.sql
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 / AuthyToOtherAuthenticator.md
Created March 31, 2021 17:38 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
View AuthyToOtherAuthenticator.md

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
View log_js_errors.js
// <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)
@freekrai
freekrai / app_GraphQL_schema.json
Created March 21, 2021 17:59 — forked from 4levels/app_GraphQL_schema.json
Sample setup Lighthouse with Lumen
View app_GraphQL_schema.json
# Just the basics: User with Images
scalar DateTime @scalar(class: "DateTime")
type User {
id: ID! @globalId
name: String
email: String
created_at: DateTime!
updated_at: DateTime!
@freekrai
freekrai / README.md
Created March 20, 2021 15:59 — forked from ppoffice/README.md
Install Visual Studio Code (actually code-server) on Android
View README.md
  1. Install Termux, an Android terminal emulator that provides a Linux execution environment and various tools.

  2. Update system packages in Termux:

    $ pkg update -y