Skip to content

Instantly share code, notes, and snippets.

View gtljaymodi's full-sized avatar
🎯
Focusing

Jay Modi gtljaymodi

🎯
Focusing
View GitHub Profile
@mjrulesamrat
mjrulesamrat / multiple_ssh_keys.md
Last active June 11, 2024 21:09
How to Setup Multiple Ssh Keys for Multiple Github/Bitbucket accounts

How to Setup Multiple Ssh Keys for Multiple Github/Bitbucket accounts

create the SSH keys.

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Add the SSH Keys to the SSH-Agent

@ambivalentno
ambivalentno / svgimagefield.py
Created February 26, 2016 10:24
A form field to handle validation of image + svg.
import sys
from io import BytesIO
from PIL import Image
import xml.etree.cElementTree as et
from django.core.exceptions import ValidationError
from django.forms import ImageField as DjangoImageField
from django.utils import six
@joewiz
joewiz / post-mortem.md
Last active October 16, 2024 07:39
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
@raelgc
raelgc / Email Server (Linux, Unix, Mac).md
Last active September 30, 2024 23:45
Setup a Local Only SMTP Email Server (Linux, Unix, Mac)

Setup a Local Only SMTP Email Server (Linux, Unix, Mac)

1 - Point localhost.com to your machine

Most of programs will not accept an email using just @localhost as domain. So, edit /etc/hosts file to make the domain localhost.com point to your machine, including this content to the file:

127.0.0.1 localhost.com

2 - Install Postfix

@ntmoe
ntmoe / mailscript.py
Created January 27, 2012 17:34 — forked from ymirpl/gist:1052094
Python unicode e-mail sending
#!/usr/bin/env python
#coding=utf8
from cStringIO import StringIO
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.header import Header
from email import Charset
from email.generator import Generator
from email.utils import formataddr
import smtplib
@ymirpl
ymirpl / gist:1052094
Created June 28, 2011 20:21
Python unicode e-mail sending
#coding: utf-8
from cStringIO import StringIO
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.header import Header
from email import Charset
from email.generator import Generator
import smtplib
# Example address data