Skip to content

Instantly share code, notes, and snippets.

View jlisee's full-sized avatar

Joseph Lisee jlisee

  • Glydways
  • Falls Church, VA
  • 08:28 (UTC -05:00)
  • LinkedIn in/jlisee
View GitHub Profile
@jlisee
jlisee / mysql_backup.py
Created September 9, 2012 22:33 — forked from ajessup/mysql_backup.py
Simple python script for performing and optionally encrypting a rolling backup a mysql DB
#!/usr/bin/env python
'''
Conduct rolling backups of a mysql DB server.
Daily backups are kept for the previous 7 days,
weekly for the previous 4 weeks, and monthly backups
for the previous 12 months.
Run ./mysql_backup --help for usage instructions
@jlisee
jlisee / download.py
Created May 11, 2013 15:15
Download and unpack a tarball from the internet with python.
# Author: Joseph Lisee <[email protected]>
# License: No rights reserved, code is in the public domain.
# Date: May 2013
__doc__ = """
Downloads and unpacks a tarball from the Internet.
"""
import argparse
import os
@jlisee
jlisee / archive.html
Last active December 23, 2015 02:08 — forked from rey/archive.html
Updated Jekyll archive template. Reduced code duplication and heading bug fix.
<section id="archive">
{% capture this_year %}{{ site.time | date: '%Y' }}{% endcapture %}
{% capture post_year %}{{ site.posts[0].date | date: '%Y' }}{% endcapture %}
{% if this_year == post_year %}
<h3>This year's posts</h3>
{% else %}
<h3>{{ post_year }}</h3>
{% endif %}
@jlisee
jlisee / rst2html_example.py
Last active December 23, 2015 03:19
Turn a reStructedTest into HTML using the docutils Python API.
#! /usr/bin/env python
# Author: Joseph Lisee <[email protected]>
__doc__ == """
Example of using docutils to process reStructedText into HTML.
Usage to file:
./rst2html_example.py README.rst -o README.html
@jlisee
jlisee / ebb_card.cpp
Last active December 23, 2015 16:29
A modified version of Andrew Kensler's business card ray tracer.
// Creating:
// c++ -O3 card.cpp -o card
// ./card > beth.ppm
//
// Rendering the letters EBB
//
// 1111100111100011110 511774
// 1000000100010010001 264337
// 1000000100010010001 264337
// 1110000111100011110 462622
@jlisee
jlisee / plumbum_speed_test.py
Created November 13, 2013 03:17
A test program to investigate command lookup speed in plumbum.
# Author: Joseph Lisee <[email protected]
import os
import time
from contextlib import contextmanager
# Little timing helper
@contextmanager
def timer(msg):
now = time.time()

Architectural Questions

  • Are responsibilities well defined?
  • Are the collaborations well defined?
  • Is coupling minimized?
  • Can you identify potential duplication?
  • Are interface definitions and constraints acceptable?
  • Can modules access needed data—when needed?
@jlisee
jlisee / embed_file.py
Last active February 27, 2020 09:21
Convert a file to a C file to embedding in a C/C++ program
#! /usr/bin/env python
# Copyright (c) 2014, Joseph Lisee
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
@jlisee
jlisee / compare-format.py
Created February 14, 2015 20:15
Diffs a C++ file, or directory of C++ files with the results of running those files through clang-format.
#! /usr/bin/env python
# Author: Joseph Lisee <[email protected]>
# Purpose: Test out various clang formatting options
# Usage: compare-format.py <diff-tool> <input-path> [<clang-options]
# Example:
# compare-format.py meld file.cpp "-style={BasedOnStyle: Google, IndentWidth: 4}"
import os
@jlisee
jlisee / dummy-web-server.py
Created May 13, 2016 15:32 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost