Skip to content

Instantly share code, notes, and snippets.

@mshmsh5000
mshmsh5000 / redirect.vcl
Created February 10, 2016 15:38
Fastly VCL for redirects stored in dicts
sub vcl_recv {
if (table.lookup(redirects, req.url)) {
error 777 "Moved";
}
#FASTLY recv
if (req.request != "HEAD" && req.request != "GET" && req.request != "FASTLYPURGE") {
return(pass);
@shajra
shajra / maxims.md
Last active June 16, 2021 14:01
Maxims for Software Development

Basic Humanity

  • Everyone is safe, respected, and treated with empathy and dignity.
  • Pay is competitive, fair, and relatively transparent.
  • Capitalize on a culture of looking at other jobs in other companies.

Organization

  • Titled leaders deeply respect their implicit influence.
  • Managers of technical workers are always highly technically skilled.
@jmoe
jmoe / fastly.rake
Last active August 29, 2015 14:06
Quick rake task to automate setting CORS headers on fastly
namespace :fastly do
desc "set fastly cors headers to fix chrome/firefox font loading issues"
task allow_cors: :environment do
# check for the Cors Allow header
versions = Yajl.load(Excon.get("https://api.fastly.com/service/#{ENV['FASTLY_SERVICE_ID']}/version",
:headers => {'Fastly-Key'=>ENV['FASTLY_API_KEY']}).body)
last_version = versions.last['number']
@xaviershay
xaviershay / build_frontend.sh
Last active December 24, 2015 20:49
SASS + Coffee + Concatenation in prod
#!/bin/bash
set -exo pipefail
BUILD_ENV=$1
if [ `uname` == 'Darwin' ]; then
OSX=1
JSCOMPRESSOR="yuicompressor --type js"
else
OSX=
$ jruby -v
jruby 1.7.5.dev (1.9.3p392) 2013-09-04 090d5dd on Java HotSpot(TM) 64-Bit Server VM 1.7.0_25-b15 [darwin-x86_64]
$ time jruby -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xverify:none -e 'require "rails"'
jruby -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xverify:none -e 5.18s user 0.47s system 136% cpu 4.142 total
$ time jruby -e 'require "rails"'
jruby -e 'require "rails"' 14.60s user 0.44s system 202% cpu 7.444 total
@mislav
mislav / _readme.md
Last active June 28, 2024 15:16
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:

@jm
jm / toml.rb
Last active December 14, 2015 03:39
TOML. Because lol.
#######################
#
# THIS IS NOW A REAL GEM (and much improved...):
# https://github.com/jm/toml
#
#######################
require 'time'
@postmodern
postmodern / rails_rce.rb
Last active July 17, 2023 11:54
Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#!/usr/bin/env ruby
#
# Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#
# ## Advisory
#
# https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion
#
# ## Caveats
#
@postmodern
postmodern / rails_jsonq.rb
Last active June 22, 2018 10:31
Proof-of-Concept exploit for Rails Unsafe Query Generation (CVE-2013-0155)
#!/usr/bin/env ruby
#
# Proof-of-Concept exploit for Rails Unsafe Query Generation (CVE-2013-0155)
#
# ## Advisory
#
# https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/t1WFuuQyavI
#
# ## Synopsis
#
@mmay
mmay / configdatabase.yml
Created June 3, 2012 18:31
Rails config/database.yml for postgres and utf8
development:
adapter: postgresql
encoding: utf8
database: <app_name>_development
pool: 5
timeout: 5000
host: localhost
test:
adapter: postgresql