Skip to content

Instantly share code, notes, and snippets.

@holmberd
holmberd / php-pools.md
Last active April 19, 2024 07:24
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@tomasevich
tomasevich / nginx_nodejs.md
Last active April 7, 2024 12:13
Сервер в связке Nginx + NodeJs

Сервер в связке Nginx + NodeJs

Данная пошаговая инструкция поможет освоить основы на простом примере

Для справки

Сервер поднимался на Debian 8 c характеристиками:

CPU - 1 ядро x 500 МГц

@dergachev
dergachev / ubuntu-eol.md
Last active December 7, 2023 22:26
What to do when your ubuntu distro is End-of-Life

Let's say you're using Ubuntu 13.04 (Raring Ringtail, released in April 2013) and it just went End-of-Life on you, because it's supported for only 6 months, and the deprecated packages are taken down after 12 months.

You'll probably figure this out the hard way. When you run sudo apt-get update, it will eventually report these errors:

Ign http://archive.ubuntu.com raring-updates/universe Sources/DiffIndex
Err http://security.ubuntu.com raring-security/main Sources
  404  Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com raring-security/universe Sources
  404  Not Found [IP: 91.189.91.15 80]
@graydon
graydon / country-bounding-boxes.py
Created April 23, 2014 00:03
country bounding boxes
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
@Kydoh
Kydoh / new_gist_file
Created November 8, 2013 14:51
Generate random password (require FOSUserBundle)
<?php
$tokenGenerator = $this->getContainer()->get('fos_user.util.token_generator');
$password = substr($tokenGenerator->generateToken(), 0, 8); // 8 chars
@JCook21
JCook21 / deploy.rb
Created November 11, 2012 18:29
Sample Capifony Deployment script
# Deployment server info
set :application, "APP NAME"
set :domain, "APP DOMAIN NAME"
set :deploy_to, "/path/on/live/server"
set :app_path, "app"
set :web_path, "web"
set :maintenance_basename, "maintenance"
# SCM info
set :repository, "GIT REMOTE REPO URL"
@naaman
naaman / delete-heroku-apps.sh
Last active March 5, 2021 20:57
[WARNING THIS WILL HARD DELETE YOUR APPS. YOU COULD LOSE DATA. MAKE SURE YOU KNOW WHAT YOURE DOING!!!!!!!!!!] Delete all heroku apps from bash terminal -- no script file required
for app in $(heroku apps); do heroku apps:destroy --app $app --confirm $app; done
@OneSadCookie
OneSadCookie / edid-decode source URL
Created October 22, 2010 23:24
EDID decoding on the Mac, to find out what resolutions and rates the Mac is seeing reported.
http://cgit.freedesktop.org/xorg/app/edid-decode/plain/edid-decode.c
compile with:
gcc edid-decode.c -o edid-decode
get EDID from IORegistryExplorer (mine, an old 24" Apple Cinema Display, is attached).
Convert to binary with this command:
ruby -e 'File.open("edid", "wb").write(File.read("edid.txt").split.map { |s| ("0x"+s).to_i(16) }.inject("", "<<"))'