- GitHub Staff
- @matthewd@mastodon.social
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 | |
require(Dir.pwd + "/config/environment") | |
ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env).each do |db_config| | |
ActiveRecord::Base.establish_connection(db_config.config) | |
context = ActiveRecord::Base.connection.migration_context | |
missing_migrations = [] |
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 | |
# This script will make a best-effort attempt at showing modifications | |
# to package-provided config files on a Debian system. | |
# | |
# It's subject to some pretty significant limitations: most notably, | |
# there's no way to identify all such config files. We approximate the | |
# answer by looking first at dpkg-managed conffiles, and then hoping | |
# that most of the time, if maintainer scripts are managing files | |
# themselves, they're using ucf. So, DO NOT TRUST THIS SCRIPT to find |
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
## | |
# Program to help you hack terminals in Fallout | |
# | |
# Usage: | |
# | |
# Run this program with a '/' separated list of possible words, and | |
# (once you've made a guess) another '/' separated list of words and | |
# scores where the word and score are separated by a ':' | |
# | |
# In this example, the words shown in my terminal were: |
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
class Range | |
def overlap(other) | |
[self.begin, other.begin].max .. [self.end, other.end].min | |
end | |
end | |
def musical_era_alive_in(start_life, end_life) | |
[ | |
['Medieval', 476..1400], | |
['Renaissance', 1400..1600], |
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
commit 604fd2cb227d92bed1b738e71feb4ff5360f4491 | |
Author: Matthew Draper <matthew@trebex.net> | |
Date: Fri Feb 19 07:50:42 2016 +1030 | |
Use a semaphore to signal message availability | |
The Event hack was too much of a hack: on actually thinking about it, | |
there's a rather obvious race. | |
diff --git a/actioncable/test/client_test.rb b/actioncable/test/client_test.rb |
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
diff --git a/actioncable/test/client_test.rb b/actioncable/test/client_test.rb | |
index d30c381..2662921 100644 | |
--- a/actioncable/test/client_test.rb | |
+++ b/actioncable/test/client_test.rb | |
@@ -54,7 +54,7 @@ def initialize(port) | |
@ws = Faye::WebSocket::Client.new("ws://127.0.0.1:#{port}/") | |
@messages = Queue.new | |
@closed = Concurrent::Event.new | |
- @has_messages = Concurrent::Event.new | |
+ @has_messages = Concurrent::Semaphore.new(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
diff --git a/lib/sprockets/manifest.rb b/lib/sprockets/manifest.rb | |
index e514ebb..9797575 100644 | |
--- a/lib/sprockets/manifest.rb | |
+++ b/lib/sprockets/manifest.rb | |
@@ -165,6 +165,8 @@ def compile(*args) | |
concurrent_compressors = [] | |
concurrent_writers = [] | |
+ pool = Concurrent::FixedThreadPool.new(5) | |
+ |
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
class Order < AR::Base | |
has_many :widgets | |
has_many :parts, through: :widget | |
end | |
class Widget < AR::Base | |
has_many :parts | |
end | |
class Part < AR::Base |
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 | |
COMMON=.common | |
if [ ! -d "$HOME/$COMMON" ]; then | |
if ! which git >/dev/null 2>&1; then | |
if which apt-get >/dev/null 2>&1 && which sudo >/dev/null 2>&1; then | |
if ! sudo apt-get install git-core; then | |
echo "Failed to install git; can't check out files" >&2 | |
exit 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
check_an_alias() { | |
alias_name="$1" | |
typed_cmd=(${(zQ)2}) | |
alias_result=(${(zQ)3}) | |
while [[ "${alias_result[1]}" = "noglob" ]] || [[ "${alias_result[1]}" = "nocorrect" ]]; do | |
shift alias_result | |
done | |
if [[ "${#alias_result}" -gt "${#typed_cmd}" ]]; then |
NewerOlder