Navigation Menu

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 / 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)
@freekrai
freekrai / app_GraphQL_schema.json
Created March 21, 2021 17:59 — forked from 4levels/app_GraphQL_schema.json
Sample setup Lighthouse with Lumen
# 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
  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
@freekrai
freekrai / fauna-adapter.js
Created November 22, 2020 20:40 — forked from s-kris/fauna-adapter.js
faunadb adapter for next-auth for next.js
// followed from next-auth repo: https://github.com/nextauthjs/next-auth
// create faunadb server key
// create collections: users, accounts, sessions, verificationRequests
// create required indexes
import faunadb, { query as q } from 'faunadb';
import { v4 as uuidv4 } from 'uuid';
import { createHash, randomBytes } from 'crypto';