Skip to content

Instantly share code, notes, and snippets.

View seven1m's full-sized avatar

Tim Morgan seven1m

View GitHub Profile
@seven1m
seven1m / open_source_church_software.md
Last active September 28, 2023 07:53
List of Open Source Church Software
View open_source_church_software.md
@seven1m
seven1m / verify.rb
Last active June 19, 2023 15:14
Example HMAC-SHA256 calculation for Planning Center Webhook Payload
View verify.rb
require 'openssl'
# get this secret from the Webhooks UI https://api.planningcenteronline.com/webhooks
secret = '2608ab74db02d670279278a90585fca300953f0a19fd96529cb61bb92ed39d86'
# raw unformatted payload
data = '{"data":[{"id":"cac783dc-75e7-4c5b-88e8-502d9d8682ae","type":"EventDelivery","attributes":{"name":"people.v2.events.person.updated","attempt":1,"payload":"{\"data\":{\"type\":\"Person\",\"id\":\"125587227\",\"attributes\":{\"accounting_administrator\":false,\"anniversary\":null,\"avatar\":\"https://avatars.planningcenteronline.com/uploads/initials/K.png\",\"birthdate\":null,\"can_create_forms\":false,\"can_email_lists\":false,\"child\":false,\"created_at\":\"2023-04-28T19:05:52Z\",\"demographic_avatar_url\":\"https://avatars.planningcenteronline.com/uploads/initials/K.png\",\"directory_status\":\"no_access\",\"first_name\":\"Kid\",\"gender\":null,\"given_name\":null,\"grade\":null,\"graduation_year\":null,\"inactivated_at\":null,\"last_name\":\"222\",\"medical_notes\":null,\"membership\":null,\"mid
@seven1m
seven1m / init.vim
Last active March 17, 2023 21:58
my vim/neovim config in < 100 LOC
View init.vim
syntax on " enable syntax highlighting
set background=dark " we like it dark!
try | colorscheme gruvbox | catch | endtry " use this awesome theme if possible
highlight Pmenu ctermbg=black guibg=black | " fix popup color so it's easier to read
filetype plugin on " load plugins based on file type
filetype indent on " load indent settings based on file type
set shiftwidth=2 " number of spaces to use for indenting
set softtabstop=2 " number of spaces to use when inserting a tab
set tabstop=2 " show tabs as 2 spaces
set expandtab " convert tabs into spaces
View DefaultKeyBinding.dict
{
/* Remap Home / End to be correct on Mac */
"\UF729" = "moveToBeginningOfLine:"; /* Home */
"\UF72B" = "moveToEndOfLine:"; /* End */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
}
@seven1m
seven1m / remote_id.rb
Created September 26, 2022 20:11
Get / Change `remote_id` in Planning Center
View remote_id.rb
# usage: ruby remote_id.rb pco_id [remote_id]
#
# pco_id Planning Center profile ID
# remote_id Specify new remote ID
#
# get remote id:
# ruby remote_id.rb 1234
#
# set remote id:
# ruby remote_id.rb 1234 5678
@seven1m
seven1m / hello_world_llvm.cpp
Last active September 24, 2022 22:14
Simple 'hello world' example in LLVM IRBuilder
View hello_world_llvm.cpp
// % clang++ $(llvm-config --cxxflags --ldflags --system-libs --libs core) -o hello_world_llvm hello_world_llvm.cpp
// % ./hello_world_llvm
// hello world
#include <llvm/ExecutionEngine/ExecutionEngine.h>
#include <llvm/ExecutionEngine/GenericValue.h>
#include <llvm/IR/IRBuilder.h>
#include <stdio.h>
using namespace llvm;
@seven1m
seven1m / webserver.rb
Created September 1, 2022 00:18
web server in pure ruby using TCPServer
View webserver.rb
require 'socket'
server = TCPServer.new 3000
loop do
client = server.accept
method, request_target, _http_version = client.gets.strip.split
headers = {}
until (line = client.gets) =~ /^\r?\n$/
name, value = line.strip.split(': ')
View 07_dijkstra.rb
# Dijjkstra's Algorithm
# Book: Grokking Algorithms by Aditya Y. Bhargava
# Chapter: 7
class ShortestPath
def initialize(start_node, dest_node, graph)
@start_node = start_node
@dest_node = dest_node
@graph = graph
@seven1m
seven1m / lots_of_symbols.rb
Last active December 21, 2021 01:54
Adaptation of the first 10,000 words from https://gist.github.com/h3xx/1976236, as a list of Ruby symbols
View lots_of_symbols.rb
:the
:of
:and
:to
:a
:in
:that
:I
:was
:he
@seven1m
seven1m / awsping.sh
Last active November 8, 2021 18:56
Script to get latency for 3 AWS US regions
View awsping.sh
#!/bin/bash
# usage: ./awsping.sh | sort -n 2.7
# 39.93 us-east-2
# 44.95 us-east-1
# 64.89 us-west-2
function region_latency() {
local region="$1"
ping -c 1 ec2.$region.amazonaws.com &>/dev/null # throw away the first ping because DNS