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
evaluate-commands %sh{ | |
plugins="$kak_config/plugins" | |
mkdir -p "$plugins" | |
[ ! -e "$plugins/plug.kak" ] && \ | |
git clone -q https://github.com/andreyorst/plug.kak.git "$plugins/plug.kak" | |
printf "%s\n" "source '$plugins/plug.kak/rc/plug.kak'" | |
} | |
plug "andreyorst/plug.kak" noload | |
plug "andreyorst/fzf.kak" config %{ |
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
local wezterm = require 'wezterm'; | |
return { | |
enable_wayland = true, | |
warn_about_missing_glyphs = false, | |
cursor_blink_rate = 800, | |
default_cursor_style = "BlinkingBlock", | |
-- font = wezterm.font('Inconsolata-g for powerline'), | |
-- font = wezterm.font("Fira Code"), | |
-- font = wezterm.font_with_fallback({"Fira Code"}), |
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 ruby | |
# vim: set filetype=ruby : | |
require 'date' | |
plan = File.read(File.expand_path('~/.plan')) | |
date = nil | |
indent = 0 |
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 'fiber' | |
class EventLoop | |
def initialize | |
@tasks = {} | |
@state = {} | |
end | |
def call(&block) | |
instance_eval &block |
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
# Enable class level code to lazily access database information. | |
# Often ActiveRecord class definitions will rely upon the table schema | |
# information. For example the following snippets would acquire a database | |
# connection: | |
# ignore_columns :foo | |
# # or | |
# attribute_names.each ... | |
# This results in rails accessing the database when booting, resulting in | |
# ridiculous behavior like this: | |
# bin/rake db:setup |
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/sh -e | |
if [ $# != 3 ] | |
then | |
echo "usage: $0 <src-port> <dst-host> <dst-port>" | |
exit 0 | |
fi | |
TMP=`mktemp -d` | |
BACK=$TMP/pipe.back |
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
module AdvisoryLock | |
class LockUnavailableError < StandardError; end | |
def with_advisory_lock(name = nil, timeout, &block) | |
raise LocalJumpError, 'no block given (yield)' unless block_given? | |
name ||= lock_name | |
args = { | |
name: ActiveRecord::Base.sanitize(name), | |
timeout: ActiveRecord::Base.sanitize(timeout), | |
} |
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
services: | |
# run db on tmpfs to speed up test runs | |
mysql: | |
image: mysql:5.7 | |
tmpfs: | |
- /var/lib/mysql |
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
module DatabaseOperations | |
module Function | |
module_function | |
def coalesce(*args) | |
Arel::Nodes::NamedFunction.new('COALESCE', args) | |
end | |
end | |
module Atomic | |
def atomic_increment(name, count = 1) |
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
namespace :graph do | |
desc 'build graph of AR models' | |
task models: :environment do | |
require 'graphviz' | |
Rails.application.eager_load! | |
g = GraphViz.new('Models', path: Rails.root.join('tmp').to_s) | |
nodes = ObjectSpace.each_object(Class) |
NewerOlder