Skip to content

Instantly share code, notes, and snippets.

:shipit:

Mat Byczkowski mbyczkowski

:shipit:
Block or report user

Report or block mbyczkowski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View try new Go version
# Assuming you already have Go installed
# Works with any released version of Go (including beta builds)
# Prior to Go 1.11 `go get golang.org/x/build/version/<GO_VERSION>` was used.
go get golang.org/dl/go1.11
# Assuming that $GOBIN is added to your $PATH
go1.11 download
@mbyczkowski
mbyczkowski / dnsmasq.sh
Last active Aug 20, 2018
Dnsmasq config for OS X
View dnsmasq.sh
#!/usr/bin/env bash
# Resolve dev domains locally and passthrough other DNS requests
set -e
dnsmasq_installed=`brew list | grep dnsmasq`
if [ -n "$dnsmasq_installed"]; then
echo "Installing Dnsmasq..."
brew install dnsmasq
@mbyczkowski
mbyczkowski / decrypt_rails_session.lua
Created Mar 10, 2017
session cookie decrypter for Rails 4.2+ (in OpenResty Lua)
View decrypt_rails_session.lua
local aes = require("resty.aes")
local str = require("resty.string")
local sha1 = require("bgcrypto.sha1")
local cjson = require("cjson")
function verify_and_decrypt_session_cookie(cookie, secret_key_base)
local rounds = 1000
local secret_length = 32
local sign_secret_length = 64
local cookie = ngx.unescape_uri(cookie)
@mbyczkowski
mbyczkowski / with_active_support.rb
Last active Apr 29, 2019 — forked from tonytonyjan/rails_42_with_active_support.rb
session cookie decrypter for Rails 4.2+
View with_active_support.rb
require 'cgi'
require 'json'
require 'active_support'
def verify_and_decrypt_session_cookie(cookie, secret_key_base)
cookie = CGI::unescape(cookie)
salt = 'encrypted cookie'
signed_salt = 'signed encrypted cookie'
key_generator = ActiveSupport::KeyGenerator.new(secret_key_base, iterations: 1000)
secret = key_generator.generate_key(salt)[0, ActiveSupport::MessageEncryptor.key_len]
View build Go from source
# create a new dir for each version of Go
git clone git@github.com:golang/go.git $HOME/go1.8
cd $HOME/go1.8
git checkout release-branch.go1.8
# assuming you installed go binary with homebrew
export GOROOT_BOOTSTRAP=/usr/local/opt/go/libexec
./all.bash
View keybase.md

Keybase proof

I hereby claim:

  • I am mbyczkowski on github.
  • I am matb (https://keybase.io/matb) on keybase.
  • I have a public key whose fingerprint is 1B88 DB20 5BFB 3A69 FFBA 16C1 CBAE 8AE6 119D 01E4

To claim this, I am signing this object:

@mbyczkowski
mbyczkowski / .codeclimate.yml
Created Jul 4, 2015
CodeClimate set-up for Node.js and Ruby project
View .codeclimate.yml
# CodeClimate supports multiple-language set-up on per-file basis
languages:
JavaScript: true
Ruby: true
@mbyczkowski
mbyczkowski / .travis.yml
Created Jul 4, 2015
Travis CI config file for Node.js and Ruby in one repo
View .travis.yml
# As of writing this (7/4/2015) Travis CI only supports one language per project
# However, every box comes with Node.js and Ruby pre-installed.
# On top of it, you can install custom programs/libraries in the the `before_script` or 'before_install`
# stages.
# The easiest approach is to go with Node.js box and install approprtiate Ruby version
# or vice-versa
language: node_js
node_js:
# pick your version of Node.js
- 0.12.2
@mbyczkowski
mbyczkowski / brdelete.sh
Last active Aug 29, 2015
Keep your git clean!
View brdelete.sh
#!/usr/bin/env ruby
STDOUT.write("---+ Pruning origin... ")
`git remote prune origin`
STDOUT.write("DONE\n")
STDOUT.write("---+ Collecting a list of merged branches to delete... ")
branch_output = `git branch -a --merged remotes/origin/master | grep -v master`
list_of_branches_to_delete = branch_output.split("\n")
# make sure we don't delete special branches, e.g. deploy branch
You can’t perform that action at this time.