Skip to content

Instantly share code, notes, and snippets.

def record_visit():
try:
with open("counter.txt", "r") as fp:
counter = int(fp.read())
except (IOError, ValueError):
counter = 0
counter = counter +1
with open("counter.txt", "w") as fp:
# cstrike plugin for python-rtmbot (https://github.com/slackapi/python-rtmbot)
import glob
import os
import re
import random
import socket
import struct
from valve.source.a2s import ServerQuerier

Keybase proof

I hereby claim:

  • I am sephii on github.
  • I am sephii (https://keybase.io/sephii) on keybase.
  • I have a public key ASAYKKp1dgRrfV3pQWriD6-LQ7Qj2Q_Drgs6P_NvXfdZSwo

To claim this, I am signing this object:

@sephii
sephii / certcheck.py
Last active February 3, 2020 07:39
Check for letsencrypt/certbot certificates expiry date. Can be run in a cron
#!/usr/bin/env python3
"""
Usage: certcheck.py host1 host2 hostN. Will exit with status code 1 if any of the hosts is about to expire (see
WARNING_DAYS below).
"""
from datetime import datetime
import socket
import ssl
@sephii
sephii / check_migrations.sh
Last active June 7, 2016 15:30
Django: make tests fail if you forgot to generate migrations
#!/bin/sh
./manage.py makemigrations --dry-run -e --no-input -v1 && echo "Missing migrations detected!" && exit 1; exit 0
@sephii
sephii / xmodel.py
Last active August 29, 2015 14:11
xmodel
from urllib2 import urlopen
from lxml import etree
import six
class Options(object):
"""
_meta class for FeedModel.
"""
@sephii
sephii / gist:46d6cf59873bac9eb553
Created December 20, 2014 11:41
example feed
<?xml version="1.0" encoding="utf-8" ?>
<competitions>
<competition id="1" name="Internal competition">
<seasons>
<season id="1" name="2013/2014" start="2013" end="2014"/>
<season id="2" name="2014/2015" start="2014" end="2015"/>
</seasons>
</competition>
</competitions>