Skip to content

Instantly share code, notes, and snippets.

View tom-monaco's full-sized avatar

Tom Monaco tom-monaco

View GitHub Profile
@tom-monaco
tom-monaco / msr_parser.py
Last active January 18, 2019 08:51
simple parser for cheap usb magnetic strip readers. this is aimed at the person who's simply curious about the data on the tracks of the strip.
while True:
terminal_input = input("scan code:")
if (terminal_input == None):
break
t1begin = terminal_input.find('%') + 1
t1end = terminal_input.find('?;', t1begin)
t2begin = terminal_input.find('?;') +2
t2end = terminal_input.find('?;', t2begin)
@tom-monaco
tom-monaco / the_app_name.service
Created October 27, 2017 06:43
Systemd Unit for Ancient Dockerized Rails App
[Unit]
Description=Start the_app_name Docker Container
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/docker start the_app_name
ExecStop=/usr/bin/docker stop the_app_name
Restart=always
@tom-monaco
tom-monaco / Dockerfile
Created October 27, 2017 06:18
Dockerfile for Ancient Rails App
FROM ruby:2.3.3
EXPOSE 3000
WORKDIR /app_root
COPY Gemfile /app_root
COPY Gemfile.lock /app_root
RUN bundle install
ENV RAILS_ENV=production
ENV RALIS_SERVE_STATIC_FILES=true
COPY . /app_root
@tom-monaco
tom-monaco / ebay-feedback-to-csv.py
Created July 12, 2015 11:55
Reformats eBay's Feedbacks XML into a CSV format
#!/usr/local/bin/python
import sys
import xml.etree.ElementTree as ET
tree = ET.parse(sys.stdin)
root = tree.getroot()
ns = { 'ebay' : 'urn:ebay:apis:eBLBaseComponents'}
def get_tag_data(element, tag_name):
@tom-monaco
tom-monaco / gzopen-missing-fix.php
Last active August 29, 2015 14:05
Fixes missing gzopen by replacing it with gzopen64. Credit goes to the Piwik team - I borrowed this code from one of their commits.
<?php
/**
* On ubuntu in some cases, there is a bug that gzopen does not exist and one must use gzopen64 instead
* Credit goes to the piwik team for this.
*/
if (!function_exists('gzopen')
&& function_exists('gzopen64')) {
function gzopen($filename , $mode = 'r', $use_include_path = 0 )
{
@tom-monaco
tom-monaco / rewritemap-generator.php
Last active November 17, 2015 09:06
WordPress to Apache RewriteMap generator
<?php
// ensure this can only be called from the command line
PHP_SAPI === 'cli' or die('not allowed');
// load Wordpress's guts so we can use the helpful functions
require( dirname(__FILE__) . '/wp-load.php' );
// get all the posts from wordpress
$posts = get_posts(array('posts_per_page' => 5000) );
@tom-monaco
tom-monaco / taskcoach_decimal_hour_display.patch
Created March 19, 2014 15:54
Taskcoach patch to enable decimal hour display in the effort viewer
Index: taskcoach/taskcoachlib/config/defaults.py
===================================================================
--- taskcoach/taskcoachlib/config/defaults.py (revision 6433)
+++ taskcoach/taskcoachlib/config/defaults.py (working copy)
@@ -524,7 +524,8 @@
'showsmwarning': 'True',
'sayreminder': 'False',
'sdtcspans': '60,120,1440,2880',
- 'sdtcspans_effort': '60,120,180,240'
+ 'sdtcspans_effort': '60,120,180,240',