This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index.html | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is free and unencumbered software released into the public domain. | |
# | |
# Anyone is free to copy, modify, publish, use, compile, sell, or | |
# distribute this software, either in source code form or as a compiled | |
# binary, for any purpose, commercial or non-commercial, and by any | |
# means. | |
# | |
# In jurisdictions that recognize copyright laws, the author or authors | |
# of this software dedicate any and all copyright interest in the | |
# software to the public domain. We make this dedication for the benefit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Multipage COW PoC | |
*/ | |
#include <fcntl.h> | |
#include <pthread.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <sys/mman.h> | |
#include <sys/stat.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cancancan_ability_ext' | |
class Ability | |
include CanCan::Ability | |
include CanCanCanAbilityExt | |
def initialize(user) | |
can :clone, Post, { id: user.post_ids } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Notifies the user of the curently active TimeWarrior task every m minutes (default 10min). | |
# Requirements | |
# - python 2.7 | |
# - pynotify | |
# Usage: | |
# python timewn.py [optional seconds] | |
import sys | |
import pynotify |
NewerOlder