Skip to content

Instantly share code, notes, and snippets.

Avatar

Sean Fulmer defulmere

  • Opalstack
View GitHub Profile
@defulmere
defulmere / list_cloudflare_ips.py
Created Feb 27, 2020
Get a list of all cloudflare IPv4 addresses with python
View list_cloudflare_ips.py
import requests
from ipaddress import *
subnets = requests.get('https://www.cloudflare.com/ips-v4').content.split()
for s in subnets:
subnet = IPv4Network(s.decode())
for h in subnet.hosts():
print(h)
@defulmere
defulmere / settings.py
Last active Sep 27, 2020
How to override an old sqlite3 module with pysqlite3 in django settings.py
View settings.py
# first: pip install pysqlite3-binary
# then in settings.py:
# these three lines swap the stdlib sqlite3 lib with the pysqlite3 package
__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
DATABASES = {
'default': {
View keybase.md

Keybase proof

I hereby claim:

  • I am defulmere on github.
  • I am defulmere (https://keybase.io/defulmere) on keybase.
  • I have a public key ASBZZcxbuMCre_b7oVVQdOToz5KHlPd_bdHCFK-QKHRa_Ao

To claim this, I am signing this object:

@defulmere
defulmere / mailbox2script.py
Last active Oct 8, 2020
replacement for WebFaction's built-in mail2script
View mailbox2script.py
#!/bin/env python
"""
mailbox2script.py
This is a replacement for WebFaction's built-in mail2script (which cannot
parse large messages > 5MB).
To use it:
You can’t perform that action at this time.