Skip to content

Instantly share code, notes, and snippets.

sokratisg / Postfix: sender-dependent SASL
Created Apr 24, 2017 — forked from zmwangx/Postfix: sender-dependent SASL
Postfix: sender-dependent SASL authentication — relay to multiple SMTP hosts, or relay to the same host but authenticate as different users (e.g., two Gmail accounts)
View Postfix: sender-dependent SASL

This is a sequel to "Postfix: relay to authenticated SMTP".

I would like to send mail from two different Gmail accounts using Postfix. Here is the relevant section in the Postfix documentation: Configuring Sender-Dependent SASL authentication.

As a concrete example, here's how to set up two Gmail accounts (only relevant sections of the config files are listed below):

    # sender-dependent sasl authentication
    smtp_sender_dependent_authentication = yes

sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay

View upstart uwsgi.conf
description "uWSGI application server in Emperor mode"
start on runlevel [2345]
stop on runlevel [!2345]
setuid bots
setgid www-data
exec /usr/local/bin/uwsgi --emperor --emperor-nofollow /etc/uwsgi/apps
View matterllo.ini
project = matterllo
base = /home/bots
chdir = %(base)/%(project)
home = %(base)/pyenv/%(project)
die-on-term = true
master = true
processes = 1
threads = 2
sokratisg / wp_update_content.sql
Created May 24, 2015
WP convert http to https
View wp_update_content.sql
UPDATE wp_posts
SET post_content = ( Replace (post_content, 'src="http://', 'src="//') )
WHERE Instr(post_content, 'jpeg') > 0
OR Instr(post_content, 'jpg') > 0
OR Instr(post_content, 'gif') > 0
OR Instr(post_content, 'png') > 0;
UPDATE wp_posts
SET post_content = ( Replace (post_content, "src='http://", "src='//") )
WHERE Instr(post_content, 'jpeg') > 0
sokratisg /
Created Apr 8, 2015
Shell oneliner to update replicas of all elasticsearch indices
for i in `curl -XGET http://localhost:9200/_cat/indices | awk '{print $3}'`; do echo "curl -XPUT 'localhost:9200/$i/_settings' -d '{\"index\":{\"number_of_replicas\":1}}'"; done
View netflow_nsel_reorder.yaml
- 4
- :nf_f_conn_id
- 4
- :nf_f_src_addr_ipv4
- 2
- :nf_f_src_port
sokratisg /
Created Jan 24, 2015
Technicolor telnetlib example
#!/usr/bin/env python
import telnetlib
import sys
max_wait = 2
prompt = "=>"
tn = telnetlib.Telnet("","23")
tn.read_until("Username : ", max_wait)
sokratisg / lircd.conf
Created Jan 11, 2015
Supertel Pilot TV Code 396 (Sony)
View lircd.conf
# Please make this file available to others
# by sending it to <>
# this config file was automatically generated
# using lirc-0.9.0-pre1(default) on Sun Jan 11 20:58:28 2015
# contributed by
# brand: /home/pi/lircd.conf
# model no. of remote control:
View grok_tester.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'grok-pure'
require 'pp'
grok =
pattern = 'your_grok_pattern'
sokratisg / vimrc
Created Sep 13, 2014
vim-enhanced configuration
View vimrc
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.