Skip to content

Instantly share code, notes, and snippets.

View dfrankland's full-sized avatar
🏕️
Catching Pokemon

Dylan Frankland dfrankland

🏕️
Catching Pokemon
View GitHub Profile
@dfrankland
dfrankland / prisma-utils.ts
Created August 16, 2022 14:55 — forked from rsaryev/prisma-utils.ts
Prisma analogue migrate rest command only programmatically, for testing purposes.
import { Prisma, PrismaClient } from '@prisma/client';
import { exec } from 'child_process';
import * as util from 'util';
const execPromisify = util.promisify(exec);
const prisma = new PrismaClient();
const tables = Prisma.dmmf.datamodel.models
.map((model) => model.dbName)
.filter((table) => table);
@dfrankland
dfrankland / README
Created March 3, 2022 04:53 — forked from jmatsushita/README
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
# Inspired by https://github.com/malob/nixpkgs I highly recommend looking at malob's repo for a more thorough configuration
#
# Let's get started
#
# Let's install nix (at the time of writing this is version 2.5.1
curl -L https://nixos.org/nix/install | sh
# I might not have needed to, but I rebooted
#!/bin/bash
# !!WARNING!!
# This will DELETE all efforts you have put into configuring nix
# Have a look through everything that gets deleted / copied over
nix-env -e '.*'
rm -rf $HOME/.nix-*
rm -rf $HOME/.config/nixpkgs
@dfrankland
dfrankland / configuration.nix
Created June 19, 2021 19:18 — forked from RobBlackwell/configuration.nix
NixOS on Dell XPS 13
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@dfrankland
dfrankland / LICENSE
Created June 4, 2021 20:32 — forked from binji/LICENSE
pokegb.cc w/o macros
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
@dfrankland
dfrankland / gpg-signing.md
Created February 8, 2021 18:32 — forked from xavierfoucrier/gpg-signing.md
GPG signing with Git and Github Desktop

Hi Github users,

You can now signed your commits on Github using at least Git 2.18.0 and Github Desktop 1.6.1.

  1. Generate a GPG key and add it to Github: https://help.github.com/articles/generating-a-new-gpg-key (if you don't want to type a passphrase on every commit, you need to press "Enter" when the console will prompt you to type a passphrase)

  2. Configure Git properly by editing the .gitconfig file using the command line git config --global --edit in a terminal, then replace YOUR_GITHUB_EMAIL, YOUR_SIGNING_KEY and GPG_BINARY_PATH with your data

@dfrankland
dfrankland / oximeter-ha.go
Created April 25, 2020 22:50 — forked from freeekanayaka/oximeter-ha.go
Sample pulse oximeter with Dqlite and Go
package main
import (
"context"
"database/sql"
"fmt"
"io"
"log"
"math/rand"
"net/http"
@dfrankland
dfrankland / webview-snapshot.c
Created November 28, 2019 08:59 — forked from rootAvish/webview-snapshot.c
This program will create an offscreen(invisible) webkit-web-view, and take a screenshot of the loaded document, the document/URL is passed as a command line argument to the program
#include <gtk/gtk.h>
#include <webkit/webkit.h>
static void destroyWindowCb(GtkWidget* widget, GtkWidget* window);
static gboolean closeWebViewCb(WebKitWebView* webView, GtkWidget* window);
static void
webkit_render_cb(WebKitWebView *webview,
@dfrankland
dfrankland / bulk import shipping rates
Created June 14, 2019 20:57 — forked from leobossmann/bulk import shipping rates
Bulk create/delete shipping rates in the Shopify backend. Go to Settings/Shipping and paste it into Javascript console. WARNING: This is a proof of concept, use with extreme caution and only if you know what you're doing, you will have to customize this to fit your needs. Again, just a proof of concept, worked for me, might not work for you. Ong…
function make_shipping_rates(id, low, mid, high) {
$.post('/admin/price_based_shipping_rates.json', {
price_based_shipping_rate: {
country_id: id,
min_order_subtotal: "0",
max_order_subtotal: "500",
name: "DHL Premiumversand",
offsets: [],
price: low
}
@dfrankland
dfrankland / debounce.py
Created February 19, 2019 20:15 — forked from walkermatt/debounce.py
A debounce function decorator in Python similar to the one in underscore.js, tested with 2.7
from threading import Timer
def debounce(wait):
""" Decorator that will postpone a functions
execution until after wait seconds
have elapsed since the last time it was invoked. """
def decorator(fn):
def debounced(*args, **kwargs):
def call_it():