Skip to content

Instantly share code, notes, and snippets.

View dgilperez's full-sized avatar
🌊
Build that!

David Gil dgilperez

🌊
Build that!
View GitHub Profile
check process redis-server
with pidfile "/var/run/redis.pid"
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if 2 restarts within 3 cycles then timeout
if totalmem > 100 Mb then alert
if children > 255 for 5 cycles then stop
if cpu usage > 95% for 3 cycles then restart
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then timeout

Nginx FastCGI response buffer sizes

By default when Nginx starts receiving a response from a FastCGI backend (such as PHP-FPM) it will buffer the response in memory before delivering it to the client. Any response larger than the set buffer size is saved to a temporary file on disk. This process is also explained at the Nginx ngx_http_fastcgi_module page document page.

Since disk is slow and memory is fast the aim is to get as many FastCGI responses passing through memory only. On the flip side we don't want to set an excessively large buffer as they are created and sized on a per request basis (it's not shared).

The related Nginx options are:

gem 'rails', '4.2.1' # prob works on others, too, but this is the one I figured it out on
require "rails"
require 'active_record'
require 'action_controller/railtie'
require 'action_view/railtie'
# ===== Configuration =====
Rails.logger = ActiveRecord::Base.logger = Logger.new $stdout
ActiveSupport::LogSubscriber.colorize_logging = false
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
alert = UIAlertView.new
alert.message = t('start')
alert.show
true
end
def t(key)
NSBundle.mainBundle.localizedStringForKey(key, value:nil, table:nil)
@dgilperez
dgilperez / gist:44d706a380ccaf05aa77
Created May 12, 2015 07:31
Rake output for SlackTextViewController in rubymotion - not linked
Build ./Pods.xcodeproj [SlackTextViewController - Release]
Compile ./Target Support Files/Pods-SlackTextViewController/Pods-SlackTextViewController-dummy.m
Compile ./SlackTextViewController/Source/Classes/SLKInputAccessoryView.m
Compile ./SlackTextViewController/Source/Classes/SLKTextInputbar.m
Compile ./SlackTextViewController/Source/Additions/SLKTextView+SLKAdditions.m
Compile ./SlackTextViewController/Source/Classes/SLKTextView.m
Compile /Users/ignaciopeinadomartinez/.rvm/gems/ruby-2.2.1/gems/cdq-1.0.2/lib/../motion/cdq/deprecation.rb
Compile /Users/ignaciopeinadomartinez/.rvm/gems/ruby-2.2.1/gems/ProMotion-2.3.1/lib/ProMotion/cocoatouch/ns_url.rb
Build ./build/iPhoneSimulator-7.1-Development
Build ./Pods.xcodeproj [SlackTextViewController - Release]
Compile ./Target Support Files/Pods-SlackTextViewController/Pods-SlackTextViewController-prefix.pch
Compile ./Target Support Files/Pods-SlackTextViewController/Pods-SlackTextViewController-dummy.m
Compile ./SlackTextViewController/Source/Classes/SLKInputAccessoryView.m
Compile ./SlackTextViewController/Source/Classes/SLKTextInputbar.m
Compile ./SlackTextViewController/Source/Additions/SLKTextView+SLKAdditions.m
Compile ./SlackTextViewController/Source/Classes/SLKTextView.m
ERROR! Building vendor project `vendor/Pods' failed to create at least one `.a' library.
** Invoke default (first_time)
** Invoke simulator (first_time)
** Execute simulator
** Invoke build:simulator (first_time)
** Execute build:simulator
rm -f ./build/iPhoneSimulator-7.1-Development/slackdemoerror2.app/Info.plist
ERROR! Building vendor project `vendor/Pods' failed to create at least one `.a' library.
/Library/RubyMotion/lib/motion/project/vendor.rb:213:in `build_xcode'
/Library/RubyMotion/lib/motion/project/vendor.rb:48:in `block in build'
/Library/RubyMotion/lib/motion/project/vendor.rb:47:in `chdir'
class MyCustomCell < UITableViewCell
# This method is used by ProMotion to instantiate cells.
def initWithStyle(style_name, reuseIdentifier: reuseIdentifier)
super
stylish
self
end
# A delegate method when the user clicks the Row(it's blue by default)
@dgilperez
dgilperez / upgradepg.md
Last active August 29, 2015 14:28 — forked from oz/upgradepg.md
Upgading from PG 9.3 to PG 9.4 on Mac OS X, with Homebrew

Brew upgrade...

Run the usual brew update, and brew upgrade to get the latest 9.4 version of PostgreSQL.

After upgrading PG from 9.3 to 9.4 with brew, the server will not start as is. If you value your database contents, and configuration, pg_upgrade is here to migrate those.

Do not delete the old binaries at once: do not run brew cleanup, because you need 9.3 binaries to migrate.

Migration

@dgilperez
dgilperez / README.md
Last active September 15, 2015 13:49 — forked from mtigas/README.md
this is the nginx config for https://mike.tig.as/, with config to avoid the BEAST exploit (by using TLS 1.2+ ciphers or RC4) and enable SSL perfect forward secrecy (by preferring ECDHE ciphers)

[mike.tig.as][mta] server configuration

This gist contains the nginx and tor configurations for the [mike.tig.as][mta] servers, mainly to show:

  • Use of the chris-lea/nginx-devel PPA to allow use of SPDY.
  • ssl_ciphers selection to mitigate BEAST attack, enable [perfect forward secrecy][pfs] if possible and select the strongest possible ciphers within those bounds. (Exception is made for several ciphers at the end of list, for compatibility reasons.)