Skip to content

Instantly share code, notes, and snippets.

View oreoshake's full-sized avatar
:octocat:
I used to make it easier to develop this site securely

Neil Matatall oreoshake

:octocat:
I used to make it easier to develop this site securely
View GitHub Profile
@oreoshake
oreoshake / application_controller.rb
Last active April 20, 2020 21:51
secure_headers basic use
class ApplicationController < ActionController::Base
def add_csp_exceptions
append_content_security_policy_directives(self.class::CSP_EXCEPTIONS)
end
end
if current_user&.samesite_lax_enabled?
SecureHeaders.use_secure_headers_override(request, :samesite_lax)
end
@oreoshake
oreoshake / stats.rb
Last active June 14, 2020 19:41
A simple script to keep tabs on an organizations use of default branches. It requires a personal access token for private repos.
# End qualified immunity
# End cash bail
# Defund the police
# Invest in addiction treatment, education, and healthcare
#
# Donate: https://www.naacpldf.org/support/fiscal-responsibility/
#
# git branch -m master main
# git push -u origin main
# Change the default branch (and updated the protected branch)
@oreoshake
oreoshake / benchmark.rb
Created January 28, 2022 07:06
Large files and ruby
require "benchmark-memory"
require "benchmark"
require "benchmark/ips"
TEST_FILE = ARGV.first
# TODO this might not be ideal but is a good start (apostrophes aren't at the beginning of a word for example, hyphens can't be at the beginning or end, there may be more punctuation to consider)
WORD_SPLIT = /[\w'-]+/
def lazy_grep
rough match? character character's ethnicity actor actor enthnicity Birthplace
🛑 Vega Spannish Jay Tavare Native American Navajo Nation
🛑 Sagat Thai Wes Studi Cherokee Oklahoma
🛑 E. Honda Japanse Peter "Navy" Tuiasosopo Samoan USA (California)
🛑 Ryu Japanese Byron Mann Chinese Honk Kong
🛑 Bison Brazilian? Thai? British? Raul Julia Puerto Rico Puerto Rico
🛑 Blanka Brazilian Robert Mammone Australian? Australia
🛑 Zangeif Russian Andrew Bryniarski American USA
🛑 Guile American Jean Claude Van Damme Belgian Belgium