Skip to content

Instantly share code, notes, and snippets.


Josh Taylor joshuataylor

View GitHub Profile
View Using zstd for fast XFS dumps
# Dumps using zstd, with up to 32 threads.
# To silence zstd, add -q
# xfsdump -L mybackup -J - / | zstd -3 --threads=0 -o /backups/mybackup.zstd
xfsdump options (
# -L session_label: Specifies a label for the dump session. It can be any arbitrary string up to 255 characters long.
# -J Inhibits the normal update of the inventory. This is useful when the media being dumped to will be discarded or overwritten.
# - sends output to stdout, for zstd to read
# / the partition directory
joshuataylor /
Created October 22, 2020 10:57
Parse dbt errors in github actions to display in github annotations
import json
import re
# Open the run_results.json, which contains results from the run or test run.
input_file = open('target/run_results.json')
json_array = json.load(input_file)
# If there is no errors, by default we just print a new line.
errors = "\n"
for item in json_array["results"]:
# Run and test have different syntaxes, this should cover them both.
View gist:111870e15b83ce29761efc9ac1b5c69d
So you have setup your API to accept CORS requests on certain paths on your API using [cors_plug]( or [corsica]( and you are wondering how you test this with ExUnit.
## Back to basics: Does the endpoint actually work?
Well the first thing to do is to check if your endpoint is actually working with CORS.
You can do this via cURL:
curl http://localhost:4000/api/posts -v -H "Origin:"
View gist:721954bd410df4bb302c53667f0ea580
foreach (var item in items)
var message = new Foobar();
await Task.WhenAll(tasks).ConfigureAwait(false);
joshuataylor / app.js
Created October 23, 2017 12:31
Preact component to notify user when a change has been made, and on route change reload the page.
View app.js
import { h, Component } from 'preact';
import { Router } from 'preact-router';
import Header from './header';
import Home from '../routes/home';
import Profile from '../routes/profile';
import NotifyChange from "./NotifyChange/index";
// import Home from 'async!../routes/home';
// import Profile from 'async!../routes/profile';
View gist:a55e7dcb49838c0868227a2682a701ed
- checkout
- restore_cache:
- project-{{ checksum "mix.exs" }}-{{ checksum "mix.lock" }}
- run:
name: deps
command: MIX_ENV=test mix deps.get
- run:
name: compile test
View gist:60348be4921994e6f494db89aa110a53
def create(conn, %{"grant_type" => "password",
"username" => username,
"password" => password}) do
try do
user = User
|> where(username: ^username)
|> where(active: true)
cond do
joshuataylor / controllers.application.js
Created February 2, 2017 14:08 — forked from poteto/controllers.application.js
ember-changeset-validations demo
View controllers.application.js
import Ember from 'ember';
import AdultValidations from '../validations/adult';
import ChildValidations from '../validations/child';
import { reservedEmails } from '../validators/uniqueness';
import { schema } from '../models/user';
const { get } = Ember;
const { keys } = Object;
export default Ember.Controller.extend({
View gist:2babe6cf3ab8175661ad3374cbc62fb8
body {
background-color: #000;
h1 {
text-align: center;
color: #fff;
left: 0;
line-height: 200px;