This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% pdfbind.tex | |
\documentclass[10pt,a4paper,twoside]{report} | |
\usepackage[final]{pdfpages} | |
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry} | |
\usepackage{fancyhdr} | |
\usepackage{lastpage} | |
\pagestyle{fancy} | |
\fancyhead{} % clear header |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stl-surface.py | |
# Generate a 3D model based on a 2D equation | |
# The model will be rectangular with a flat base. The top surface is based on | |
# a provided equation in "surface_function". The file name can be set with the | |
# output_filename variable. The x and y width of the model and the grid spacing | |
# is defined by the following parameters. | |
# x_spacing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to encode and decode a file backed up as a series of printed QR codes | |
# Install the required tools | |
sudo apt-get update | |
sudo apt-get install zbar-tools imagemagick qrencode | |
################################################################################ | |
# Convert the file to a base 64 encoded format. Probably not needed as QR codes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import combinations, chain | |
# https://stackoverflow.com/questions/5920643/add-an-item-between-each-item-already-in-the-list | |
def intersperse(lst, item): | |
result = [item] * (len(lst) * 2) | |
result[0::2] = lst | |
return result | |
pins = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rectangleBuilder | |
# Grant Trebbin - 2017_01_17 | |
import svgwrite | |
class Rectangle: | |
def __init__(self, rectangle_width, rectangle_height): | |
# Calculate coordinates for corners and middle of sides for rectangle | |
# These are offset from the bottom left |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import scipy.special as sp | |
a = 1.55 | |
current = 1 | |
mu = 4 * np.pi / 10000000 | |
# equal to sqrt(4ra(z^2 + (a+r)^2)^(-1)) | |
def k_val (R, Z): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import svgwrite | |
import math | |
# mogrify -format gif *.svg | |
# gifsicle --scale 0.2 --delay=5 --loop --optimize=2 --colors=256 --multifile *.gif > OutGIF/out.gif | |
order = 3 | |
number_of_index_bits = order * 2 | |
number_of_elements = pow(2, number_of_index_bits) | |
x_offset = 130 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mailbox | |
from email.header import decode_header | |
import re | |
import itertools | |
regex = re.compile('[^a-zA-Z0-9]') | |
words = [] | |
for message in mailbox.mbox('Inbox.mbox'): | |
subject, encoding = decode_header(message['subject'])[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Backs up and encrypts a directory or file | |
.DESCRIPTION | |
Backs up files or directories by adding it them a tar file and then | |
encrypting it with a public key. Becuase public key encryption is used | |
there are no passwords stored anywhere. | |
gpg must be installed and the public key you want to use must be imported. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Hex_To_Bytes($hex){ | |
# Takes a string with an even number of hexadecimal characters and | |
# converts it two characters at a time to an array of bytes half as long | |
# Initialize ouput byte array | |
$hexLength = $hex.Length | |
$byteLength = $hexLength / 2 | |
$bytes = ,0 * ($byteLength) | |
# generate bytes by taking 2 hexadecimal characters at a time |
NewerOlder