Skip to content

Instantly share code, notes, and snippets.

View NickWoodhams's full-sized avatar

Nick Woodhams NickWoodhams

View GitHub Profile
@NickWoodhams
NickWoodhams / zebraprint.sh
Created January 29, 2013 22:07
Print a UPS Label GIF on a Zebra 2844 @203 PPI
#!/bin/sh
filename=$1
echo "Begin processing file:" $filename
dimensions=$(identify -format '%w %h' $filename)
IFS=' ' read -a array <<< "$dimensions"
width=${array[0]}
height=${array[1]}
@NickWoodhams
NickWoodhams / random_matrix.py
Last active February 1, 2017 22:01
Generate a tuple with two random ints between 0 and 1000
#! /usr/bin/python
# required library to create a matrix
import numpy
# random int library
from random import randint
from pprint import pprint
@NickWoodhams
NickWoodhams / script.m
Created January 23, 2017 10:59
Generate scatterplot with 2 different colors
data =xlsread('data.xlsx');
vec1 = data (:,1);
vec2 = data (:,2);
mean_vec1 = mean(vec1)
hold on
find(vec1);
find(vec2);
hold on;
@NickWoodhams
NickWoodhams / helpers.py
Created January 12, 2017 18:13
Swap line break characters for div elements you can style. Useful for Displaying Textarea input values.
def nl2lb(value):
return value.replace('\n', '<div class="line-break"></div>')
# Or even simpler
def nl2br(value):
return value.replace('\n', '<br>')
@NickWoodhams
NickWoodhams / create_clover_efi_single_drive.sh
Created December 28, 2016 19:47
Copy Clover installation from /EFI to UEFI partition on target drive. Change disk0 with with your target drive. Find disk number with "diskutil list" command.
#!/bin/sh
sudo newfs_msdos -v EFI -F 32 /dev/rdisk0s1
sudo mkdir /Volumes/EFI
sudo mount -t msdos /dev/disk0s1 /Volumes/EFI
sudo rm -rf /Volumes/EFI/EFI
sudo cp -R /EFI /Volumes/EFI
sudo diskutil unmount /Volumes/EFI
@NickWoodhams
NickWoodhams / script.js
Created July 8, 2013 18:27
Flask Toolip sample library for Bootstrap
$(document).ready(function(){
$('.close').click(function(){
$(this).closest('.popover').remove();
});
});
@NickWoodhams
NickWoodhams / opendoor.php
Created July 24, 2016 20:39
Open door script (takes input from twilio)
<?php
print("function called!");
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
function CallAPI($method, $url, $data = false)
{
@NickWoodhams
NickWoodhams / Dockerfile
Created March 8, 2016 22:40
Running Deluge behind OpenVPN in Docker Container
#sudo docker run --name openvpn-deluge --privileged --restart=always -v /home/nick/Dev/vpn:/vpn -v /home/deluge/.config/deluge:/deluged/config -v /disk1:/disk1 -i -t openvpn_deluge /bin/bash
FROM ubuntu:14.04
MAINTAINER Nick Woodhams
RUN apt-get -y update
RUN apt-get install -y openvpn
RUN apt-get install -y deluged deluge-web deluge-console
COPY start.sh start.sh
CMD ["/start.sh"]
@NickWoodhams
NickWoodhams / quickssl.bundle
Created February 2, 2016 18:02
QuickSSL Premium CA Bundle - Order of Certificates: Domain -> CA -> Root
-----BEGIN CERTIFICATE-----
MIIERDCCAyygAwIBAgIDAjp4MA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNVBAYTAlVT
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
YWwgQ0EwHhcNMTQwODI5MjIyNDU4WhcNMjIwNTIwMjIyNDU4WjBmMQswCQYDVQQG
EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEdMBsGA1UECxMURG9tYWluIFZh
bGlkYXRlZCBTU0wxIDAeBgNVBAMTF0dlb1RydXN0IERWIFNTTCBDQSAtIEc0MIIB
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA30GUetr35DFDtuoBG1zOY+r6
baPZau4tmnX51ZxbvTTf2BzJbdgEiNputbe18DCuQNZd+sRTwdQinQROEaaV1UV8
QQVY4Ezd+e5VvV9G3K0TCJ0s5PeC5gcrng6MNKHOxKHggXCGAAY/Lep8myiuGyiL
OQnT5/BFpLG6EWeQVXuP3u04XKHh44PEw3KRT5juHMKAqmSlPoNiHMzgnvhawBMS
@NickWoodhams
NickWoodhams / clear-drupal-cache-selenium.py
Created September 20, 2013 11:03
Automatically clear Drupal Cache - Execute from Github Hook for extra automation goodness
# -*- coding: utf-8 -*-
"""
Post push to Staging
~~~~~~~~~~~~~~~~~~~~
No more manual cache clearing
"""
from selenium import webdriver
from selenium.common.exceptions import TimeoutException