Skip to content

Instantly share code, notes, and snippets.

# Lua Prometheus collecter and exporter
lua_shared_dict prometheus_metrics 200M;
lua_package_path "{{nginx_lua_prometheus_path}}/?.lua";
init_by_lua '
prometheus = require("prometheus").init("prometheus_metrics")
metric_requests = prometheus:counter(
"nginx_http_requests_total", "Number of HTTP requests", {"host", "app","status", "uri", "method"})
metric_latency = prometheus:histogram(
"nginx_http_request_duration_seconds", "HTTP request latency", {"host", "app","status", "uri", "method"})
@zevarito
zevarito / assert_running_containers.yml
Created September 12, 2016 18:00
Ansible task to ensure which containers should be running
# Check which containers should be running
- name: fail if container not running
command: "docker inspect --format='{% raw %}{{.State.Status}}{% endraw %}' {{ item }}"
register: command_result
failed_when: command_result.stdout != 'running'
ignore_errors: True
with_items:
- api
- web
@zevarito
zevarito / Macros.h
Last active January 30, 2019 08:54 — forked from numo16/Macros.h
Some useful iOS/Objective-C Macros
#define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
#define UserDefaults [NSUserDefaults standardUserDefaults]
#define NotificationCenter [NSNotificationCenter defaultCenter]
#define SharedApplication [UIApplication sharedApplication]
#define Bundle [NSBundle mainBundle]
#define MainScreen [UIScreen mainScreen]
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x
#define NavBar self.navigationController.navigationBar
class Cart::WizardWidget < Cart::BaseWidget
has_widgets do
setup(options)
self << widget("cart/list", :cart_list, :display, purchase_order: @purchase_order)
self << widget("cart/resume", :cart_resume)
self << widget("shipping/form", :shipping_form, :display, purchase_order: @purchase_order)
self << widget("payment/form", :payment_form)
self << widget("authentication")
# Controller
has_widgets do |root|
root << widget("cart/wizard", :cart_wizard, :display, purchase_order: @purchase_order)
end
# Cart Wizard Widget
after_initialize :setup!
@zevarito
zevarito / geolocation.js
Created July 26, 2012 13:41
JS Geolocation sample
define("Geolocation", {
deviceSupport: function() {
if(navigator.geolocation)
return true;
else if(google.gears)
return true;
else
return false;
},
actionmailer (2.3.4, 2.3.2, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.2)
actionpack (2.3.4, 2.3.2, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.2)
activerecord (2.3.4, 2.3.2, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.2)
activeresource (2.3.4, 2.3.2, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.2)
activesupport (2.3.4, 2.3.2, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.2)
adzap-ar_mailer (2.1.5)
ambethia-smtp-tls (1.1.2)
binarylogic-authlogic (2.1.1)
bones (2.5.1)
brynary-webrat (0.4.0)