Skip to content

Instantly share code, notes, and snippets.

View nleclerc's full-sized avatar

Nicolas Leclerc nleclerc

View GitHub Profile
@nleclerc
nleclerc / post-mortem.md
Created January 20, 2021 16:49 — 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 *.

  1. * 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.)
  2. Added fs.file-max = 70000 to /etc/sysctl.conf
@nleclerc
nleclerc / gist:6ef5e53c05f3bba74caa0bd8fd2cb8d4
Created July 17, 2019 15:51
list cpu and motherboard on macos.
sysctl -n machdep.cpu.brand_string
ioreg -rc FakeSMCKeyStore
@nleclerc
nleclerc / gist:346b8891fb80efb97e9d57417d375440
Last active February 6, 2019 11:18
Get hardware description on OSX
ioreg -rc FakeSMCKeyStore
sysctl -n machdep.cpu.brand_string
system_profiler SPHardwareDataType
@nleclerc
nleclerc / atom-keymap.cson
Created October 22, 2015 10:29
Atom keyboard shortcut configuration
# Your keymap
#
# Atom keymaps work similarly to stylesheets. Just as stylesheets use selectors
# to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
# Change these settings to your own preference
#!/bin/bash
read -p "You're going to install a lot of stuff, do you want to proceed ? [y/n]" -r
echo # skip line
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Installing OSX base System."\
&& echo "Setting up terminal parameters."\
&& echo -e "export CLICOLOR=1\nexport TERM=xterm-color\nexport COLORTERM=xterm\nexport LSCOLORS=ExFxCxDxBxegedabagacad\n\nexport GIT_PS1_SHOWDIRTYSTATE=1\nexport PS1='\\[\\033[01;32m\\]\\u@\\h\\[\\033[01;34m\\] \\w\\[\\033[01;33m\\]\$(__git_ps1)\\[\\033[01;34m\\] \\[\\033[00m\\]\\$ '\n\nalias ls='ls -h'\nalias ll='ls -l'\nalias la='ls -al'\nalias l='ls -l'\n" >> ~/.bash_profile\
@nleclerc
nleclerc / coffeelint.json
Created December 8, 2014 12:22
coffeelint configuration
{
"arrow_spacing": {
"level": "ignore"
},
"camel_case_classes": {
"level": "error"
},
"coffeescript_error": {
"level": "error"
},
@nleclerc
nleclerc / .bash_profile
Created March 21, 2014 15:09
OSX terminal colors
export CLICOLOR=1
export TERM=xterm-color
export COLORTERM=xterm
export LSCOLORS=ExFxCxDxBxegedabagacad
@nleclerc
nleclerc / gist:7565005
Created November 20, 2013 15:27
sublime text osx key binding
[
{ "keys": ["super+space"], "command": "auto_complete" },
{ "keys": ["super+space"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
]
},
{ "keys": ["super+shift+k"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
@nleclerc
nleclerc / sublimetext-conf.json
Last active December 28, 2015 21:28
sublime text configuration
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Monokai Extended/Monokai Extended.tmTheme",
"enable_tab_scrolling": false,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",