Skip to content

Instantly share code, notes, and snippets.

@cwebber314
cwebber314 / demote_html.py
Created November 12, 2013 03:34
I use this gist to concatenate stand-along html files or embed one html file in a master html file.
from bs4 import BeautifulSoup
fn = r'solution1_printed.htm'
f = open(fn, 'r')
html = f.read()
f.close()
soup = BeautifulSoup(html)
body = soup.body
replaces = [
@cwebber314
cwebber314 / olvDemo_image.py
Created November 18, 2013 06:52
object list view demo with added image. I can't get the AddNamedImages() to work so I use the AddImages() method.
#####################################################################
# olvDemo.py
#
# Created 12/2009 by Mike Driscoll
#
# Based on example code from source and
# http://objectlistview.sourceforge.net/python/cellEditing.html
#
#####################################################################
import wx
@cwebber314
cwebber314 / tree_table
Last active December 29, 2015 11:59
quick and dirty static tree using a table in html. It's not a real tree, but I want a grid that hints at hierarchy.
<!DOCTYPE html>
<html>
<script>
var folder="https://lh3.googleusercontent.com/-oV4dZvrGpyA/UpYSO1u-fjI/AAAAAAAAJRI/PO6Bq3aYtS0/s16-no/page.png"
var page="https://lh3.googleusercontent.com/-oV4dZvrGpyA/UpYSO1u-fjI/AAAAAAAAJRI/PO6Bq3aYtS0/s16-no/page.png"
</script>
<head>
<style>
table {
border-collapse:collapse;
@cwebber314
cwebber314 / reportlab_hello.py
Created January 20, 2014 04:34
Reportlab hello world with an image, bulleted list, and enumerated list.
"""
Reportlab sandbox.
"""
from reportlab.lib.enums import TA_JUSTIFY
from reportlab.lib.pagesizes import letter, landscape
from reportlab.lib.enums import TA_JUSTIFY
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
@cwebber314
cwebber314 / xlpandas_test.py
Last active January 10, 2018 13:08
Example of using XLPandas to write a pretty dataframe to excel
"""
pandas 0.12.0
"""
from numpy.random import randn
import numpy as np
import xlwt
import pandas as pd
from xlpandas import XLtable, XLseries
from xlwt import Workbook, Worksheet, Style
import os
@cwebber314
cwebber314 / sav2raw.py
Created February 12, 2015 16:38
PSSE .sav file to .raw file
"""
Convert sav file to raw file.
Requires pssepath from:
https://github.com/cwebber314/pssepath
"""
import os.path as osp
import sys
import argparse
import pssepath
@cwebber314
cwebber314 / psspy_redirect.py
Last active August 29, 2015 14:15
Capture output from psspy commands
import pssepath
pssepath.add_pssepath()
import psspy
import redirect
redirect.psse2py()
import sys
# This command prints results to console
"""
TODO: Please Give me a name
======================
And a brief description.
Input files:
- DIFF: file with a set of instruction which area applied to the dna sequences in
the REFERENCE file.
- REFERENCE: File with reference DNA sequences.
@cwebber314
cwebber314 / line_constants_math.ipynb
Last active April 17, 2017 13:00
Line Constants Math
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cwebber314
cwebber314 / perfboard.scad
Last active January 6, 2018 01:13
quarter size Adafruit perfboard mount
// Screwless mount for a perfborad:
// Adafruit Perma-Proto Quarter-sized Breadboard PCB
bh=5; // base height
d=35.8;
module spacer(x=0, y=0, z=0){
translate([x,y,z]){
cylinder(d=5, h=10);
cylinder(d=3.2, h=12);
}
}