Determine the memory impact of storing indicator counts in one big hash, or several smaller hashes.
See the redis memory docs for the advantages of several smaller hashes.
Store 10mm values in one big hash. Code:
r = Redis.new
Determine the memory impact of storing indicator counts in one big hash, or several smaller hashes.
See the redis memory docs for the advantages of several smaller hashes.
Store 10mm values in one big hash. Code:
r = Redis.new
# /tmp/test = EBS-SSD | |
# /mnt/test = instance-store | |
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test | |
256+0 records in | |
256+0 records out | |
268435456 bytes (268 MB) copied, 3.26957 s, 82.1 MB/s | |
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test | |
256+0 records in | |
256+0 records out |
# Inspired by https://github.com/gabebw/dotfiles/blob/master/gitconfig.erb | |
[user] | |
name = Aaron Suggs | |
email = XXX | |
[core] | |
excludesfile = ~/.gitignore | |
[apply] | |
whitespace = nowarn | |
[diff] | |
color = auto |
FROM ubuntu:14.04 | |
MAINTAINER [email protected] | |
RUN apt-get update | |
RUN apt-get install -y build-essential libssl-dev curl | |
# Install ruby-build | |
RUN export ruby_build_release=20140420 && \ |
The asset pipeline changed a bit in Rails4, and I've never been super happy w/ the egads approach to tar'ing assets.
So here's my idea for a better approach.
Features:
#!/usr/bin/env ruby | |
## | |
# Restore simplenote backup | |
# | |
# If you want to restore your Simplenote for Mac database, you can use this script. | |
# I created it for this issue: | |
# http://help.simplenote.com/customer/en/portal/questions/2773965-most-of-my-notes-were-deleted?new=2773965 | |
# | |
# First, find a good backup of your simplenote database stored in |
# First blacklist checks for /etc/password, and counts hits in cache | |
blacklist 'etc/password' do | |
if req.query_string =~ %r{/etc/passwd} | |
Fail2Ban.fail('etc_password', req.ip, limit: 3, period: 24.hours, ban_for: 24.hours) | |
end | |
end | |
# 2nd blacklist checks for banned IPs in cache | |
blacklist 'banned_ips' do | |
Fail2Ban.banned?(req.ip) |
require 'thor' | |
module Thor | |
class CommandFailedError < Error; end | |
module Actions | |
# runs command, raises CommandFailedError unless exit status is 0. | |
def run_or_die(command, config={}) | |
result = run(command, config) | |
if behavior == :invoke && $?.exitstatus != 0 | |
message = "#{command} failed with %s" % ($?.exitstatus ? "exit status #{$?.exitstatus}" : "no exit status (likely force killed)") |
source 'https://rubygems.org' | |
gem 'rack-attack', :ref => '1c01e6097ce18f486d887ebbeb9f0c4b434cd8f5', :git => 'https://github.com/kickstarter/rack-attack.git' | |
gem 'redis-activesupport' |
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'bundler/setup' | |
require 'octokit' | |
require 'yaml' | |
commit = ARGV.first || 'HEAD' | |
full_sha = `git rev-parse --verify #{commit}`.strip |