Skip to content

Instantly share code, notes, and snippets.

Avatar

Austin Story Austio

View GitHub Profile
@Austio
Austio / The Many Meanings of Event-Driven Architecture.md
Created Apr 26, 2021 — forked from xpepper/The Many Meanings of Event-Driven Architecture.md
My notes on the talk "The Many Meanings of Event-Driven Architecture" by Martin Fowler (GOTO 2017)
View The Many Meanings of Event-Driven Architecture.md

GOTO 2017 • The Many Meanings of Event-Driven Architecture - Martin Fowler

(the video is here, the original talk notes are here)

At least one of those four patterns are in play when you talk about "event-driven" architectures:

  1. Event Notification: components communicating via events
  2. Event-carried State Transfer: allowing components to access data without calling the source
  3. Event Sourcing: using an event log as the primary record for a system
  4. CQRS: having a separate component for updating a store from any readers of the store
@Austio
Austio / pundit_example.rb
Created Feb 19, 2021 — forked from rmosolgo/pundit_example.rb
Example of GraphQL::Pro pundit_integration with node field
View pundit_example.rb
require "bundler/inline"
gemfile do
gem "pundit", "2.1.0"
gem "graphql", "1.12.5"
source "https://gems.graphql.pro" do
gem "graphql-pro", "1.17.6"
end
end
View gist:dfc5bd1acd7c3cd799fa604cec7ee638
<!DOCTYPE html>
<html>
<body>
<h1>Before</h1>
<script>
// Object.assign
if (typeof Object.assign != 'function') {
Object.assign = function(target) {
'use strict';
@Austio
Austio / Rails.rd
Created Nov 28, 2020
Rails 1 file reproduction template
View Rails.rd
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
@Austio
Austio / tellmeyoursecrets.js
Created Nov 20, 2019 — forked from woodwardtw/tellmeyoursecrets.js
google script that lists a lot of info about the files in a particular folder/sub folder structure including viewers, editors, and sharing permissions
View tellmeyoursecrets.js
function listFolders(folder) {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow(["Name", "Sharing Access", "Sharing Permission", "Get Editors", "Get Viewers", "Date", "Size", "URL", "Download", "Description", "Type"]); //writes the headers
var folder = DriveApp.getFolderById("YOUR_FOLDER_ID");//that long chunk of random numbers/letters in the URL when you navigate to the folder
var files = folder.getFiles();//initial loop on loose files w/in the folder
var cnt = 0;
var file;
@Austio
Austio / gist:c5d83deec7e8ff2d1a44998ef01e3edb
Created Nov 15, 2019 — forked from chanks/gist:7585810
Turning PostgreSQL into a queue serving 10,000 jobs per second
View gist:c5d83deec7e8ff2d1a44998ef01e3edb

Turning PostgreSQL into a queue serving 10,000 jobs per second

RDBMS-based job queues have been criticized recently for being unable to handle heavy loads. And they deserve it, to some extent, because the queries used to safely lock a job have been pretty hairy. SELECT FOR UPDATE followed by an UPDATE works fine at first, but then you add more workers, and each is trying to SELECT FOR UPDATE the same row (and maybe throwing NOWAIT in there, then catching the errors and retrying), and things slow down.

On top of that, they have to actually update the row to mark it as locked, so the rest of your workers are sitting there waiting while one of them propagates its lock to disk (and the disks of however many servers you're replicating to). QueueClassic got some mileage out of the novel idea of randomly picking a row near the front of the queue to lock, but I can't still seem to get more than an an extra few hundred jobs per second out of it under heavy load.

So, many developers have started going straight t

@Austio
Austio / tmux-test-runner.vim
Created Nov 14, 2019 — forked from codenamev/tmux-test-runner.vim
Run specs from vim in another tmux pane.
View tmux-test-runner.vim
map <silent> <Leader>rl :w<cr>:silent call RunCurrentLineInTest('!ts bundle exec rspec')<cr>:silent redraw!<cr>
map <silent> <Leader>rt :w<cr>:silent call RunCurrentTest('!ts bundle exec rspec')<cr>:silent redraw!<cr>
" Test runner helpers
function! RunCurrentTest(rspec_type)
let in_test_file = match(expand("%"), '\(.feature\|_spec.rb\|_test.rb\)$') != -1
if in_test_file
call SetTestFile()
if match(expand('%'), '\.feature$') != -1
@Austio
Austio / ioread.c
Created Feb 24, 2019
memory safe get io
View ioread.c
#include <stdio.h>
#include <string.h>
#define OK 0
#define NO_INPUT 1
#define TOO_LONG 2
#define SMALL_BUFF 3
// https://stackoverflow.com/questions/2430303/disadvantages-of-scanf
static int getLine (char *prmpt, char *buff, size_t sz) {
@Austio
Austio / arch-linux-install
Last active Nov 17, 2018 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
View arch-linux-install
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap