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
@dgilperez
dgilperez / codewall.badges.js
Last active August 26, 2015 23:19 — forked from marcinbunsch/codewall.badges.js
Coderwall - display missing badges
// How to use this:
// 1. Go to the desired profile page on coderwall, like http://coderwall.com/marcinbunsch
// 2. Paste this gist in the JS console
//
// You can also probably use this in greasemonkey and dot.js
//
// Also, it was tested in Chrome, Firefox and Safari, it probably will
// not work in IE, but I just don't care about it ;)
//
// UPDATE: Coderwall made changes to the site and I cannot retrieve the achievements, so they are hardcoded, taken from a cached version of the achievements page
@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

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)
** 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'
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.
@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
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)
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

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:

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