I hereby claim:
- I am chriscz on github.
- I am chriscz (https://keybase.io/chriscz) on keybase.
- I have a public key whose fingerprint is 53C4 0540 6C16 09E7 F32A A341 AA42 2257 9499 8735
To claim this, I am signing this object:
# FIXME Rails has-one through is nil on unpersisted objects (bug) | |
# https://github.com/rails/rails/issues/33155 | |
module ActiveRecordUnpersistedHasOneFix | |
extend ActiveSupport::Concern | |
# Define utility methods | |
class << self | |
# @return [Array<String>, nil] | |
def association_path(model_class, association) | |
path = [] |
#!/bin/bash | |
SOURCE=${BASH_SOURCE[0]} | |
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink | |
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd ) | |
SOURCE=$(readlink "$SOURCE") | |
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located | |
done | |
SCRIPT_DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd ) |
# Place under initializers/yaml_autoloader.rb | |
class PsychLoaderPatch | |
include Singleton | |
def initialize | |
logfile = File.open(Rails.root.join("log/yaml_disallowed_classes.log").to_s, "a") | |
logfile.sync = true | |
@logger = Logger.new(logfile) |
#!/usr/bin/env bash | |
set -eou pipefail | |
# This is probably waaay too long. | |
CERTIFICATE_VALID_DAYS=36500 | |
NAME="$(getent passwd $(whoami) | awk -F: '{print $5}')" | |
OUTPUT_DIR="/root/module-signing" | |
KEY_FILE="${OUTPUT_DIR}/MOK.priv" |
# Requires inotify-tools to be installed. On Ubuntu / Debian: | |
# sudo apt install inotify-tools | |
CRYSTAL=crystal | |
TEST_ARGS=--chaos --parallel 4 --verbose | |
SPEC_ARGS=--order=random --error-on-warnings --verbose | |
WATCH=src/**/*.cr spec/**/*.cr test/**/*.cr | |
# The make rule to use when running tests. Either spec or test | |
TEST_RULE=test |
require 'cancancan_ability_ext' | |
class Ability | |
include CanCan::Ability | |
include CanCanCanAbilityExt | |
def initialize(user) | |
can :clone, Post, { id: user.post_ids } | |
end | |
end |
I hereby claim:
To claim this, I am signing this object:
index.html | |
#!/bin/bash | |
# https://gist.github.com/sofyanhadia/37787e5ed098c97919b8c593f0ec44d8 | |
# Make sure you grab the latest version | |
set -euo pipefail | |
VERSION='3.5.1' | |
FILENAME=protoc-${VERSION}-linux-x86_64.zip | |
INSTALL="/opt/protobuf/protoc-${VERSION}" | |
CURRENT="/opt/protobuf/current" |
import signal | |
import os | |
import readline | |
from pprint import pprint | |
def handle_shell(signal, frame): | |
frames = [] | |
while frame: |