Skip to content

Instantly share code, notes, and snippets.

2013-11-27 13:45:53,861 WARN [qtp862267590-371] [server.AbstractHttpConnection] /v2/nodes/puppetdb2.db.corp.scl3.mozilla.com/facts
org.postgresql.util.PSQLException: This connection has been closed.
at org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:714)
at org.postgresql.jdbc2.AbstractJdbc2Connection.setAutoCommit(AbstractJdbc2Connection.java:661)
at com.jolbox.bonecp.ConnectionHandle.setAutoCommit(ConnectionHandle.java:1063)
at clojure.java.jdbc.internal$transaction_STAR_.invoke(internal.clj:222)
at com.puppetlabs.puppetdb.http.v3.facts$query_facts$fn__6061.invoke(facts.clj:18)
at clojure.java.jdbc.internal$with_connection_STAR_.invoke(internal.clj:186)
at com.puppetlabs.puppetdb.http.v3.facts$query_facts.invoke(facts.clj:18)
at com.puppetlabs.puppetdb.http.v2.facts$query_app$fn__6119$fn__6124.invoke(facts.clj:11)
@limed
limed / create-list
Created March 19, 2014 22:55
Create calendar resources in zimbra that is set to forward to a mailman serer
#!/bin/bash
IAM=`id -un`
if [ "$IAM" != "zimbra" ]; then
echo "You must run this script as the 'zimbra' user. Please 'su - zimbra' first."
exit 1
fi
randpw(){ < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16}; echo; }
password=`randpw`
RBLDNSD="dnsbl -b 10.20.77.61 -f -r/var/lib/rbldns -w work \
sbl.dnsbl:ip4set:sbl \
pbl.dnsbl:ip4trie:pbl \
xbl.dnsbl:ip4tset:xbl \
zen.dnsbl:ip4set:sbl \
zen.dnsbl:ip4trie:pbl \
zen.dnsbl:ip4tset:xbl"
@limed
limed / mailstats.py
Last active August 29, 2015 14:06
Counts top senders that are sending from mozilla.com and mozillafoundation.org
#!/usr/bin/python
# Counts top senders from postfix logs, this script filters out
# only mozilla.com and mozillafoundation.org domains
import re
import sys
import os
threshold = 2000
CSV = True # if someone wants it in csv format then sure you can enable it
@limed
limed / aper.py
Last active August 29, 2015 14:06
Generates SA rule file based on a list of email addresses
#!/usr/bin/python
import urllib2
import sys
import datetime
import re
address_file_url = 'http://svn.code.sf.net/p/aper/code/phishing_reply_addresses'
# SA Rule stuff
@limed
limed / gapps-forwards.sh
Last active April 28, 2016 18:09
Adds shadow domain aliases for mozilla's google apps domain using gam
#!/bin/bash
# Sets forward in google apps via gam, only works on your local machine
GAM="python $HOME/gam/gam.py"
for i in `${GAM} print users aliases | egrep -v 'gapps.mozilla|gapps.mozillafoundation' | sed 1d`; do
email=`echo ${i} | cut -d , -f1`
shortname=`echo $email| sed -E 's/(.+)\@.+/\1/'`
domain=`echo $email | sed -E 's/.+\@(.+)/\1/'`
if [[ $domain == 'mozilla.com' ]]; then
@limed
limed / avg-members
Created May 29, 2015 19:19
Calculates average members per list
#!/bin/bash
BASEDIR=/usr/lib/mailman
all_list=$(${BASEDIR}/bin/list_lists -b)
num_list=$(${BASEDIR}/bin/list_lists -b | wc -l)
for i in ${all_list}; do
member_num=$(${BASEDIR}/bin/list_members ${i} | wc -l)
member_sum=$(( $member_sum + $member_num ))
# Find the IAM username belonging to the TARGET_ACCESS_KEY
# Useful for finding IAM user corresponding to a compromised AWS credential
# Requirements:
#
# Environmental variables:
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
# python:
# boto
@limed
limed / aws_create_iam_user.py
Created June 2, 2015 22:16
Creates iam user and generates a secret key for them
#!/usr/bin/python
# Script to create user and generate access key
# This script assumes a bunch of things and is by no way
# perfect
import boto.iam
import boto.exception
import os
import sys

Keybase proof

I hereby claim:

  • I am limed on github.
  • I am limed (https://keybase.io/limed) on keybase.
  • I have a public key whose fingerprint is 7197 975B 1051 12D1 3047 3D74 8E1F AEB9 00B5 575B

To claim this, I am signing this object: