Skip to content

Instantly share code, notes, and snippets.

View ericuldall's full-sized avatar
🎯
Let's get it

Eric Uldall ericuldall

🎯
Let's get it
View GitHub Profile
@ericuldall
ericuldall / post-mortem.md
Created December 21, 2016 23:32 — forked from joewiz/post-mortem.md
Recovery from nginx "Too many open files" error on Amazon AWS Linux

On Tue Oct 27, 2015, history.state.gov began buckling under load, intermittently issuing 500 errors. Nginx's error log was sprinkled with the following errors:

2015/10/27 21:48:36 [crit] 2475#0: accept4() failed (24: Too many open files) 2015/10/27 21:48:36 [alert] 2475#0: *7163915 socket() failed (24: Too many open files) while connecting to upstream...

An article at http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ provided directions that mostly worked. Below are the steps we followed. The steps that diverged from the article's directions are marked with an *.

    • Instead of using su to run ulimit on the nginx account, use ps aux | grep nginx to locate nginx's process IDs. Then query each process's file handle limits using cat /proc/pid/limits (where pid is the process id retrieved from ps). (Note: sudo may be necessary on your system for the cat command here, depending on your system.)
  1. Added fs.file-max = 70000 to /etc/sysctl.conf
  2. Added `nginx soft nofile 1
@ericuldall
ericuldall / Scala Math Object
Last active June 3, 2016 00:24 — forked from anonymous/kata.scala
Scala Kata shared content
import com.scalakata._
@instrument class Playground {
object Math {
def add(ints:Array[Int]): Int = {
var sum = 0
var i=0
while(i < ints.length){
sum += ints(i)
i += 1
@ericuldall
ericuldall / bq_audit.js
Created December 17, 2015 19:09 — forked from anonymous/bq_audit.js
An easy way to audit big query costs in node
var audit = { //configure audit settings
export: {
project_id: 'PROJECT ID TO AUDIT QUERIES FROM'
},
import: {
project_id: 'PROJECT ID TO STORE AUDIT DATA IN',
dataset_id: 'DATASET ID TO STORE AUDIT DATA IN',
table_id: 'TABLE ID TO STORE AUDIT DATA IN'
}
};
@ericuldall
ericuldall / gist:634296884365ce935da1
Created June 11, 2015 03:43
Python Exercise Thingy
#!/usr/bin/python
import numpy
numbers = '731671765313306249192251196744265747423553491949349698352031277450632623957831801698480186947885184385861560789112949495459501737958331952853208805511125406987471585238630507156932909632952274430435576689664895044524452316173185640309871112172238311362229893423380308135336276614282806444486645238749303589072962904915604407723907138105158593079608667017242712188399879790879227492190169972088809377665727333001053367881220235421809751254540594752243525849077116705560136048395864467063244157221553975369781797784617406495514929086256932197846862248283972241375657056057490261407972968652414535100474821663704844031998900088952434506585412275886668811642717147992444292823086346567481391912316282458617866458359124566529476545682848912883142607690042242190226710556263211111093705442175069416589604080719840385096245544436298123098787992724428490918884580156166097919133875499200524063689912560717606058861164671094050775410022569831552000559357297257163626956188267042825248360082
@ericuldall
ericuldall / gist:a2e08503b1321b9fcc67
Last active August 29, 2015 14:08
Geo Spatial Curl Recreation
#CREATE INDEX WITH MAPPING
curl -XPOST localhost:9200/things -d '{
"settings": {
"number_of_shards": 1
},
"mappings": {
"thing": {
"properties": {
"pin.location": {"type" : "geo_point"}
}