Skip to content

Instantly share code, notes, and snippets.

View jamtur01's full-sized avatar
💭
I may be slow to respond.

James Turnbull jamtur01

💭
I may be slow to respond.
View GitHub Profile
@jamtur01
jamtur01 / convert.py
Created July 1, 2022 18:02 — forked from mturilin/convert.py
Converst TextExpander csv to espanso yaml
#!/usr/bin/python3
import yaml
import sys
import csv
# create root yaml
matches = []
# open file
FROM ubuntu:12.04
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openjdk-6-jdk curl git-core build-essential bzr
RUN mkdir -p /tmp/downloads
# install go
RUN curl -sf -o /tmp/downloads/go1.1.1.linux-amd64.tar.gz -L https://go.googlecode.com/files/go1.1.1.linux-amd64.tar.gz
RUN mkdir -p /opt && cd /opt && tar xfz /tmp/downloads/go1.1.1.linux-amd64.tar.gz
# install jenkins
RUN curl -sf -o /opt/jenkins-1.523.war -L http://mirrors.jenkins-ci.org/war/1.523/jenkins.war
@jamtur01
jamtur01 / ExportKindle.js
Last active June 19, 2020 05:35 — forked from jkubecki/ExportKindle.js
Amazon Kindle Export
// The following data should be run in the console while viewing the page https://read.amazon.com/
// It will export a CSV file called "download" which can (and should) be renamed with a .csv extension
var db = openDatabase('K4W', '3', 'thedatabase', 1024 * 1024);
getAmazonCsv = function() {
// Set header for CSV export line - change this if you change the fields used
var csvData = "ASIN,ISBN,Title,Authors,PurchaseDate\n";
db.transaction(function(tx) {
@jamtur01
jamtur01 / block_personal_appts
Created October 10, 2019 05:46 — forked from ttrahan/block_personal_appts
Google Apps Script to automatically create, edit and delete events on work calendar for personal calendar events. Instructions on how to set up can be found at https://medium.com/@willroman/auto-block-time-on-your-work-google-calendar-for-your-personal-events-2a752ae91dab
function sync() {
var id="XXXXXXXXXX"; // CHANGE - id of the secondary calendar to pull events from
var today=new Date();
var enddate=new Date();
enddate.setDate(today.getDate()+7); // how many days in advance to monitor and block off time
var secondaryCal=CalendarApp.getCalendarById(id);
var secondaryEvents=secondaryCal.getEvents(today,enddate);
@jamtur01
jamtur01 / aws-ecs-deploy.sh
Created February 11, 2017 21:40 — forked from chethanbandi/aws-ecs-deploy.sh
AWS ecs deployment
NAME=server
ECR=<repo_url>
VERSION=${BUILD_NUMBER}
TAG=${ECR}/${NAME}:${VERSION}
eval $(aws ecr get-login)
docker build -t $TAG .
if[ $? -ne 0 ];then
echo "Docker build failed exiting"
@jamtur01
jamtur01 / gist:1248295
Created September 28, 2011 15:49 — forked from geemus/gist:1248281
2012 Fukuoka Ruby Award Competition
  1. Outline Explain briefly functions and feature.

fog provides a consistent, simple interface to many cloud services. The simple interface helps new users get started fast with Cloud services. The consistent approach allows users to undertake arbitrage to find the best provider for their needs and helps them to migrate to another provider should their needs change. fog's open source license has also created a community around the product that greatly reduces the time needed to extend the interface when a Cloud new product or feature is released.

  1. Purpose and Aim Describe the purpose of development, aim and market targeted.

Cloud services are complicated and widely disparate. Evaluating your Cloud options, getting started in the Cloud, and migrating your data and workloads can all be very difficult and expensive activities. fog seeks to alleviate this by providing a simple interoperable on ramp to a wide selection of Cloud services. In doing so it opens up Cloud computing for everyone instead of the sele

@jamtur01
jamtur01 / Importing posts from Wordpress into Jekyll.rb
Created August 8, 2011 02:00 — forked from zanshin/Importing posts from Wordpress into Jekyll.rb
The script I used to import posts from my Wordpress blog into a new Jekyll one - modified to add tags and categories and NOT convert to Markdown
%w(rubygems pp sequel fileutils yaml active_support/inflector).each{|g| require g}
module WordPress
def self.import(database, user, password, table_prefix = "wp", host = 'localhost')
db = Sequel.mysql(database, :user => user, :password => password, :host => host, :encoding => 'utf8')
%w(_posts _drafts images/posts/featured).each{|folder| FileUtils.mkdir_p folder}
query = <<-EOS
@jamtur01
jamtur01 / middleware.rb
Created June 11, 2011 03:19 — forked from skippy/middleware.rb
delete vagrant vm's chef client and node from chef server on destroy
class OnDestroyMiddleware
def initialize(app, env)
@app = app
end
def call(env)
env["config"].vm.provisioners.each do |provisioner|
env.ui.info "Attempting to remove client #{provisioner.config.node_name}"
`knife client show #{provisioner.config.node_name}`
if $?.to_i == 0
# script/console
include IssuesHelper
include CustomFieldsHelper
# All issues and projects
File.open('output-file.csv','w') do |f|
f.puts issues_to_csv(Issue.all)
end
# the "puppet" project