Skip to content

Instantly share code, notes, and snippets.

@ahmetb
ahmetb / gcpauth.go
Created May 22, 2018 17:21
Authenticating to GKE cluster with client-go, IAM service account and a Google auth plugin written from scratch
package main
import (
"context"
"fmt"
"log"
"net/http"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active November 3, 2024 17:14
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@uri
uri / stack.exs
Last active October 30, 2017 14:12
Two implementations of a stack in Elixir; one using GenServer and the other with send, receive, and pids.
defmodule StackGenServer do
use GenServer
def start, do: GenServer.start(__MODULE__, [], name: __MODULE__)
def query, do: GenServer.call(__MODULE__, :query)
def pop, do: GenServer.call(__MODULE__, :pop)
def push(element), do: GenServer.call(__MODULE__, { :push, element })
def handle_call(:query, _from, stack), do: {:reply, stack, stack}
def handle_call(:pop, _from, [h|t]), do: {:reply, h, t}
def handle_call(:pop, _from, []), do: {:reply, nil, []}
def handle_call({ :push, element }, _from, stack), do: {:reply, [element | stack], [element | stack]}
@grantspeelman
grantspeelman / Gemfile
Last active December 16, 2020 13:11
Example Gemfile files preparing for the next rails upgrade (https://grant-ps.blog/2017/07/03/upgrading-ruby-on-rails-in-smallish-steps/)
@next_upgrade ||= false
source 'https://rubygems.org'
if @next_upgrade
gem 'rails', '6.0.0.rc2'
else
gem 'rails', '~> 5.2.0'
end
# rest of gems below ....
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@kurtfunai
kurtfunai / README.md
Last active December 27, 2015 10:39 — forked from nickbudi/README.md

Kurts's CS:GO Config (Forked from Afterlife budi's)

This is my constantly updated CS:GO autoexec config.

Put the file autoexec.cfg in ...\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\cfg or take what you want from it and add to your autoexec config!

Launch Options

-novid -noborder -high -threads 4 -freq 144 -refresh 144 +exec autoexec.cfg +mat_vignette_enable 0 -processheap
@jstorimer
jstorimer / tclient.rb
Created June 25, 2013 21:09
These scripts were the result of the "Faster Rails test runs...with Unix!" screencast at https://www.youtube.com/watch?v=RSehcT4MnRM.
#!/usr/bin/env ruby
require 'socket'
test_file = ARGV[0]
socket = UNIXSocket.new('testing.sock')
socket.write(test_file)
socket.close_write
@mislav
mislav / _readme.md
Last active September 28, 2024 23:03
tmux-vim integration to transparently switch between tmux panes and vim split windows

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

@kincorvia
kincorvia / gist:4540489
Created January 15, 2013 17:54
VCR Depecrations
# Typically in Rails to use VCR we setup the RSpec config like so:
RSpec.configure do |config|
config.extend VCR::RSpec::Macros #deprecated
end
# This gives us access to the use_vcr_cassette method:
describe Reviewed::Article do
use_vcr_cassette 'article/grill'
end
@adrianseeley
adrianseeley / Crowd Complete - nodeJS
Created November 18, 2012 15:19
Crowd Complete :: a NodeJS Snippit for Ranked Crowd Sourced Auto Complete (Auto Complete Artificial Neural Network)
/* Crowd Complete :: a NodeJS Snippit for Ranked Crowd Sourced Auto Complete (Auto Complete Artificial Neural Network)
Usage:
Requires a running mongo database (db_url)
No solutions exist until you build them over time by 'feeding' the database with /fb.
/ac?e=getAutocompleteSolutionsFromAcDatabase
/fb?e=thisTextIsACompleteUserEntryThatIsBeingFedBackToTheAcDatabase
What is this?
TL;DR - Google's magic autocomplete bar.