Skip to content

Instantly share code, notes, and snippets.

View void-elf's full-sized avatar
🥕
eating om nom nom

void-elf

🥕
eating om nom nom
View GitHub Profile
<html>
<head>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-71069301-2', 'auto');
ga('require', 'dnt');
ga('send', 'pageview');
@void-elf
void-elf / atari_graphs.py
Last active June 20, 2017 07:08
Multipanel Atari graphs!
def produce_plots(axes_array, games, plotable_data):
count = 0
scale = 1.0
for axis, game in zip(axes_array, games):
axis.set_title(game.name)
axis.set_ylabel(game.axis_label)
# scatter plot of results in the literature
for n, m in enumerate(game.measures):
kwargs = {"c": "r"}
@void-elf
void-elf / thing.sh
Created June 14, 2017 03:01
mystery certbot-auto-cron RHEL diff
if [ "$configure_cron" -eq 1 -a -f /etc/debian_version ]; then
+ # when a normal user creates a crontab via `sudo`, it gets added to the root crontab
+ root_crontab_dir=/var/spool/cron/crontabs/root
ConfigureCronDeb
+ elif [ "$configure_cron" -eq 1 -a -f /etc/redhat-release ]; then
+ ConfigureCronDeb # will this work???
elif [ "$configure_cron" = 1 ]; then
echo "Generating cron jobs for your system is not supported yet."
echo "For instructions on doing this manually:"
- echo "https://certbot.eff.org/docs/using.html#renewing-certificates" # these instructions would freak a beginner out
def cert_path_to_lineage(config):
# If config.cert_path is defined, find an appropriate value for config.certname
# by searching through available files in config.renewal_configs_dir, and finding
# one with an appropriate value for 'fullchain'.
# pylint: disable=unused-argument
def update_cert_name_for_cert_path_match(candidate_lineage, rv):
""" Return the lineagename or return None. """
options = [candidate_lineage.fullchain_path, candidate_lineage.chain_path,
os.path.join(candidate_lineage.archive_dir, os.path.basename(config.cert_path[0]))]
Traceback (most recent call last):
File "/root/projects/forks/certbot/venv/bin/certbot", line 11, in <module>
load_entry_point('certbot', 'console_scripts', 'certbot')()
File "/root/projects/forks/certbot/certbot/main.py", line 735, in main
plugins = plugins_disco.PluginsRegistry.find_all()
File "/root/projects/forks/certbot/certbot/plugins/disco.py", line 183, in find_all
plugin_ep = PluginEntryPoint(entry_point)
File "/root/projects/forks/certbot/certbot/plugins/disco.py", line 34, in __init__
self.plugin_cls = entry_point.load()
File "/root/projects/forks/certbot/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2301, in load

note when testing: don't rely on revoke to catch things.

case tested test written does it work
delete using cert_path only y
... cert_name only y sort of, but it's not supposed to bc of how revoke works ...
w/ matching cert_name, path y
mismatched name and path y cert storage error gets thrown (via search_lineages)
mism., name doesn't exist y ""
mism., path doesn't exist y it seems revoke catches the error
@void-elf
void-elf / example_verification.py
Created January 27, 2017 23:30
Verifying a certificate's signature matches the CA's public key using python-cryptography.
from cryptography import x509
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.backends import default_backend
cert_file = open('/etc/letsencrypt/live/www.example.com/cert.pem')
cert_data = cert_file.read()
cert = x509.load_pem_x509_certificate(data=cert_data, backend=default_backend())
# chain contains the Let's Encrypt certificate
@void-elf
void-elf / ex.md
Created January 27, 2017 17:35
No module `six.moves` & other problems on CentOS 6.6

pip's -U option is causing some problems when setting up the certbot developer environment on CentOS 6.8.

Here's what happened (edited to be less text):

[demo@yom-centos-512mb-sfo2-01 test]$ git clone git@github.com:ynasser/certbot.git
[demo@yom-centos-512mb-sfo2-01 test]$ cd certbot/
[demo@yom-centos-512mb-sfo2-01 certbot]$ ./letsencrypt-auto-source/letsencrypt-auto --os-packages-only
OS packages installed.
[demo@yom-centos-512mb-sfo2-01 certbot]$ ./tools/venv.sh
+ command -v python2
from cryptography import x509
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.backends import default_backend
cert_file = open('/etc/letsencrypt/live/www.example.com/cert.pem')
cert_data = cert_file.read()
cert = x509.load_pem_x509_certificate(data=cert_data, backend=default_backend())
cert_pk = cert.public_key()
cert_pn = cert_pk.public_numbers()
@void-elf
void-elf / woof.py
Created January 21, 2016 19:02 — forked from robcowie/woof.py
woof.py One-time file server
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# woof -- an ad-hoc single file webserver
# Copyright (C) 2004-2009 Simon Budig <simon@budig.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.