Skip to content

Instantly share code, notes, and snippets.

View samandmoore's full-sized avatar

Sam Moore samandmoore

View GitHub Profile
@zepptron
zepptron / gist:9635568b9d90d858daca7780feb8c4b7
Created June 19, 2018 08:34
.bashrc & .zshrc: usefull kubectl + fzf
podlog () {
local pod=($(kubectl get pods --all-namespaces -o wide | fzf | awk '{print $1, $2}'))
echo kubectl logs -n ${pod[1]} ${pod[2]}
kubectl logs -n ${pod[1]} ${pod[2]}
}
podexec () {
local pod=($(kubectl get pods --all-namespaces -o wide | fzf | awk '{print $1, $2}'))
local cmd=${@:-"/bin/sh"}
@smudge
smudge / switch_remote_from_upstream_to_fork.sh
Last active March 30, 2022 14:18
Switch a git repo to track a fork origin, with read-only upstream.
#### Switch a git repo to track a fork origin, with read-only upstream.
# Step 1: Press that "fork" button on github to fork a repo to your account.
# (Don't worry -- if it's a private repo, your fork will still be private
# and should be effectively owned by the original repo's organization.)
# Step 2: Update your local repo
# IMPORTANT: This assumes your local repo is a clone of the ORIGINAL/upstream repo.
## Add a new 'upstream' remote and add a bogus URL for push commands.
@lvangool
lvangool / sidekiq_safe_shutdown.rb
Last active July 30, 2024 13:21
Kubernetes: Graceful Sidekiq Shutdown
#! /usr/bin/env ruby
# encoding: utf-8
## PURPOSE: this script will quiet any sidekiq workers it finds,
## and then shut them down when they are no longer handling jobs
# utility class for logging and running commands
class Utils
require 'open3'
attr_accessor :output
@minillinim
minillinim / howto.md
Created May 10, 2017 05:43
Buildkite + monorepo + hooks

If you use a monorepo you can place a .buildkite/pipeline.yml in each of the sub repos/folders and set buildkite to look there using a pipeline command as your first step. Such as:

[[ -f "<SUB_FOLDER>/.buildkite/pipeline.yml" ]] && buildkite-agent pipeline upload <SUB_FOLDER>/.buildkite/pipeline.yml || true

Where <SUB_FOLDER> is the name of your sub repo / folder.

Unfortunately, if you try to use pre- and post-command hooks this way buildkite won't pick them up, it

@hmnhf
hmnhf / mandrillapp_invalid_sender_characters.rb
Last active November 13, 2020 09:20
Mandrillapp invalid sender characters
# I was encountering this exception: Net::SMTPServerBusy: 401 4.1.7 Bad sender address syntax
# First I searched to see if there's any documentation around this issue but didn't find anything,
# so I wrote this snippet to find those invalid characters.
require 'mail'
Mail.defaults do
delivery_method :smtp, {
port: 25,
address: "smtp.mandrillapp.com",

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@tokenvolt
tokenvolt / simple_form_bootstrap3.rb
Last active November 2, 2023 11:55
Bootstrap 3 simple form initializer
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
BEGIN TRANSACTION
-- Remove existing constraints on old table
ALTER TABLE [dbo].[ChatMessages] DROP CONSTRAINT [FK_ChatMessages_ChatRooms_Room_Key]
GO
ALTER TABLE [dbo].[ChatMessages] DROP CONSTRAINT [FK_ChatMessages_ChatUsers_User_Key]
GO
-- Create new table
@davidfowl
davidfowl / jabbr-lorem.js
Last active December 14, 2015 04:29
Test script for simulating typing in jabbr.
var at = 0;
var words = ["Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.",
"Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.",
"Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.",
"Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.",
"Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem.",
"Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius.",
"Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum.",
"Mirum est notare quam littera gothica, quam nunc putam