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
# config/initializers/sidekiq_max_memory_middleware.rb | |
require 'socket' | |
class MaxMemoryMiddleware | |
attr_reader :active, :max_oom, :shutdown | |
cattr_reader :cached_mb, :last_checked_at, :hostname | |
def initialize | |
if ENV['MAX_SIDEKIQ_OOM'] | |
@active = true |
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/python | |
# -*- coding: utf-8 -*- | |
# Copyright 2014 Robert Beekman <[email protected]> | |
# | |
# This file is part of Ansible | |
# | |
# Ansible is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or |
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 'rubygems' | |
require 'mqtt' | |
MQTT::Client.connect('192.168.0.20') do |client| | |
client.subscribe('components/plex/on', 'components/plex/off') | |
client.get do |topic,message| | |
case topic | |
when 'components/plex/on' then `open -a /Applications/Plex.app` |
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 @Appsignal | |
constructor: -> | |
@action = "" | |
@tags = {} | |
set_action: (action) -> | |
@action = action | |
tag_request: (tags) -> |
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/python | |
# -*- coding: utf-8 -*- | |
# Copyright 2014 Robert Beekman <[email protected]> | |
# | |
# This file is part of Ansible | |
# | |
# Ansible is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or |
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/python | |
# -*- coding: utf-8 -*- | |
# Copyright 2014 Robert Beekman <[email protected]> | |
# | |
# This file is part of Ansible | |
# | |
# Ansible is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or |
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
description "Matrioska" | |
start on runlevel [2] | |
stop on runlevel [016] | |
env GOMAXPROCS=4 | |
export GOMAXPROCS | |
limit nofile 4096 8192 | |
respawn # respawn the service if it dies |
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
http { | |
proxy_cache_path /tmp/cache levels=1:2 keys_zone=photo-cache:8m max_size=5000m inactive=43829m; | |
proxy_cache_key $host$uri$is_args$args; | |
server { | |
proxy_cache photo-cache; | |
listen 80; | |
server_name cdn.matsimitsu.com; | |
access_log logs/cdn.access.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
module Authenticator | |
class Authentication | |
def initialize(app, options = {}) | |
@app, @options = app, options | |
end | |
def call(env) | |
if authenticated? | |
@app.call(env) |
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
env['rack.input'].read(1) | |
env['rack.input'].rewind |