Skip to content

Instantly share code, notes, and snippets.

View filipposc5's full-sized avatar

Filippos Chalvatzoglou filipposc5

View GitHub Profile
@filipposc5
filipposc5 / validate-smtp-tls.py
Created June 27, 2016 16:02
Sample script to validate SMTP TLS
import smtplib
import os
s= smtplib.SMTP('smtp.sendgrid.net', 587)
s.starttls()
#(220, 'Begin TLS negotiation now')
s.ehlo("staging2.pq.dsd.io")
#(250, 'smtp.sendgrid.net\n8BITMIME\nPIPELINING\nSIZE 31457280\nSTARTTLS\nAUTH PLAIN LOGIN\nAUTH=PLAIN LOGIN')
s.login(os.environ['SMTP_USERNAME'], os.environ['SMTP_PASSWORD'])
#Traceback (most recent call last):
@filipposc5
filipposc5 / .dockerignore
Last active June 13, 2016 16:15
Sample dockerfile skeleton
Dockerfile
@filipposc5
filipposc5 / wttr.sh
Created June 13, 2016 10:26
Useless wttr.in prompt made in a hurry
export WEATHERLOC=London # set to override
export PS1='$WEATHER \h:\W \u\$ '
export PROMPT_COMMAND="find /tmp/weather.cache -mtime +7m -exec curl -s wttr.in/$WEATHERLOC -o /tmp/weather.cache \;;export WEATHER=\"$(sed -n '4p' /tmp/weather.cache | sed 's/.* m\([0-9].*C\)/\1/g' )\""
@filipposc5
filipposc5 / uploading-to-pypi.md
Last active July 13, 2017 09:02
Uploading to pypi

Uploading to pypi

0. Before you start

Verify (in repo):

  • setup.py has been updated
  • CHANGELOG has been updated

1. Ensure credentials are there

(env)classy:bootstrap-cfn filippos$ cat ~/.pypirc
@filipposc5
filipposc5 / fabfile.py
Last active February 10, 2016 18:42
Fast "fab" environment debug!
# Add this to your fabfile:
@task
def debugme():
import pdb
pdb.set_trace()
# Then run
# fab env:...etc... debugme
#
@filipposc5
filipposc5 / test-reddit.py
Created December 10, 2015 16:47
Testing reddit class
import sys
import os
try:
import unittest2 as unittest
except ImportError:
import unittest
class RedditTest(unittest.TestCase):
@filipposc5
filipposc5 / Graphite-scrapbook.md
Last active November 20, 2015 08:48
Graphite Scrapbook

Line listeners

SHORT .. line listeners:
root@83d5eeeb3086:/opt/graphite/conf# grep -B1  LINE_RECEIVER carbon.conf

LINE_RECEIVER_INTERFACE = 127.0.0.1
LINE_RECEIVER_PORT = 2003
--
@filipposc5
filipposc5 / git-crypt-delete
Last active October 12, 2015 14:48 — forked from ashb/git-crypt-delete
git-crypt-delete
#!/bin/bash
set -o pipefail
case "$1" in
--list|-l)
list_only=1
;;
--dry-run|-n)
@filipposc5
filipposc5 / dtrace-file.md
Created October 1, 2015 12:31
While troubleshooting crontab
classy:~ root# dtrace -n 'syscall::open*:entry /execname == "crontab"/ { printf("%s %s",execname,copyinstr(arg0)); }' 
dtrace: description 'syscall::open*:entry ' matched 4 probes
CPU     ID                    FUNCTION:NAME
  0    181                       open:entry crontab /dev/dtracehelper
  0    181                       open:entry crontab /tmp/crontab.TdnlWVWmE4
  2    967              open_nocancel:entry crontab /usr/share/locale/en_GB.UTF-8/LC_COLLATE
  2    967              open_nocancel:entry crontab /usr/share/locale/en_GB.UTF-8/LC_CTYPE
  2    967              open_nocancel:entry crontab /usr/share/locale/en_GB.UTF-8/LC_MONETARY
  2    967              open_nocancel:entry crontab /usr/share/locale/en_GB.UTF-8/LC_NUMERIC
@filipposc5
filipposc5 / salt-shaker.sh
Created September 14, 2015 14:00
salt shaker in bash .. just kidding ..
cat ../logstash-formula/formula-requirements.txt | while read x ; do o1=$(echo $x | sed s/=.*$//g | sed 's/git@/https:\/\/codeload./' | sed 's/m:/m\//' | sed 's/.git$/\/zip\//'); o2=$(echo $x | sed s/.*==//g) ; wget -O a.zip $o1$o2 ; ls -l a.zip; unzip a.zip ; rm -f a.zip ; o3=$(echo $x | sed 's/.*\/\(.*\)\.git.*/\1/') ; echo $o3 ; mv ${o3}* $o3 ; done