Skip to content

Instantly share code, notes, and snippets.

View seanieb's full-sized avatar
🦔
Trying to build suff!

Seanie Byrne seanieb

🦔
Trying to build suff!
View GitHub Profile
@seanieb
seanieb / redis-producer-consumer.py
Created January 7, 2022 11:41 — forked from igniteflow/redis-producer-consumer.py
A very simple implementation of a Redis producer-consumer messaging queue in Python
import redis
import time
import sys
def producer():
r = redis.Redis()
i = 0
while True:
r.rpush('queue', 'Message %d' % i)
@seanieb
seanieb / ec2-user-data-ubuntu-18.04-libpam-google-authenticator.sh
Created November 23, 2019 20:24
Install ssh only google-authenticator for users using EC2 User Data on first boot.
#!/bin/bash
# Ubuntu 18.04 account creation and Google 2FA/MFA for use on EC2 User data at instance launch
# Create users when launching an Ubuntu server EC2 instance
declare -A USERKEY
# Create users when launching an Ubuntu server EC2 instance
@seanieb
seanieb / postmortem.md
Created November 22, 2017 19:34 — forked from mlafeldt/postmortem.md
Example Postmortem from SRE book, pp. 487-491

Shakespeare Sonnet++ Postmortem (incident #465)

Date

2015-10-21

Authors

  • jennifer
  • martym
@seanieb
seanieb / csv_generated_string_escape.py
Last active September 16, 2023 07:56
Prevent CSV Injection when suing user generated data
def escape_csv(user_generated_string):
"""
CSV injection esacaping for Python. Excel treats a string as active content when it encounters a
"trigger" character at the start of the string. This method returns the string with
the triger character escaped.
"""
if user_generated_string[0] in ('@','+','-', '='):
user_generated_string = "'" + user_generated_string
from __future__ import unicode_literals
from urlparse import parse_qs
import requests
from requests_oauthlib import OAuth1
key = "key"
secret ="secret"
oauth = OAuth1(key, secret)