This file contains hidden or 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
| defaults write com.apple.Terminal CopyAttributesProfile com.apple.Terminal.no-attributes |
This file contains hidden or 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
| defaults write com.apple.Terminal CopyAttributesProfile com.apple.Terminal.no-attributes |
This file contains hidden or 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 "terminal-table" | |
| slim_path = ARGV[0] | |
| fat_path = ARGV[1] | |
| def parse_objects(path) | |
| ok = false | |
| counts = {} |
This file contains hidden or 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 "json" | |
| require "rack/cors" | |
| class Page | |
| def each | |
| loop do | |
| count = [1, 2, 3].sample | |
| words = %w(one two thee four five six seven).sample(count) | |
| json = words.map { |word| | |
| { word: word }.to_json |
This file contains hidden or 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 Page | |
| def each | |
| loop do | |
| yield %w(one two thee four five).sample | |
| sleep 1 | |
| end | |
| end | |
| end | |
| use Rack::Chunked |
This file contains hidden or 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 | |
| def parse_query(query) | |
| lines = query.split("\n") | |
| [lines.shift, lines.join("\n")] | |
| end | |
| require "shellwords" | |
| path = ARGV[0] or abort "Usage: tail_slow_log.rb <path_to_slow_log>" |
This file contains hidden or 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
| SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND != 'Sleep' ORDER BY TIME DESC; |
This file contains hidden or 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 | |
| # Slack notification script for Munin | |
| # Mark Matienzo (@anarchivist) | |
| # | |
| # To use: | |
| # 1) Create a new incoming webhook for Slack | |
| # 2) Edit the configuration variables that start with "SLACK_" and "MUNIN_URL" below | |
| # 3) Add the following to your munin configuration: | |
| # |
This file contains hidden or 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 "benchmark" | |
| fields = [:f1, :f2, :f3, :f4, :f5, :f6] | |
| struct = Struct.new("Something", *fields) | |
| values_array = 10_000.times.map { | |
| [rand(10000), rand(10000), rand(10000), rand(10000), rand(10000), rand(10000)] | |
| } | |
| Benchmark.bm(10) do |x| |
This file contains hidden or 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
| here="$( cd "$(dirname "$0")"; pwd )" |