Skip to content

Instantly share code, notes, and snippets.

Avatar

Roger Stringer freekrai

View GitHub Profile
@freekrai
freekrai / dnsmasq OS X.md
Created Jul 20, 2021 — 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 Apr 17, 2021 — 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);
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 Mar 26, 2021 — 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 Mar 21, 2021 — 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 Mar 20, 2021 — 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
@freekrai
freekrai / fauna-adapter.js
Created Nov 22, 2020 — forked from s-kris/fauna-adapter.js
faunadb adapter for next-auth for next.js
View fauna-adapter.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';
@freekrai
freekrai / .zshrc
Created Nov 17, 2020 — forked from callumlocke/.zshrc
ZSH function to auto-switch to correct Node version
View .zshrc
####
# ZSH function to auto-switch to correct Node version
# https://gist.github.com/callumlocke/30990e247e52ab6ac1aa98e5f0e5bbf5
#
# - Searches up your directory tree for the closest .nvmrc, just like `nvm use` does.
#
# - If you are already on the right Node version, IT DOES NOTHING, AND PRINTS NOTHING.
#
# - Works correctly if your .nvmrc file contains something relaxed/generic,
# like "4" or "v12.0" or "stable".