Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

James Turnbull jamtur01

💭
I may be slow to respond.
View GitHub Profile
@mturilin
mturilin / convert.py
Created Jan 26, 2020
Converst TextExpander csv to espanso yaml
View convert.py
#!/usr/bin/python3
import yaml
import sys
import csv
# create root yaml
matches = []
# open file
@IngmarStein
IngmarStein / ECSDynamicHostPort.go
Last active Jan 21, 2020
Get dynamically mapped host port from within ECS container
View ECSDynamicHostPort.go
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
"os"
"bufio"
View aws-ecs-deploy.sh
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"
@armon
armon / reap.sh
Created Feb 21, 2015
Reap Graphite nodes using Consul members
View reap.sh
#!/bin/bash
# Store the live members
consul members | grep alive | awk '{ print $1 }' > /tmp/alive.txt
# Clean-up the collectd metrics
cd /data/graphite/whisper/collectd
ls | awk '{print substr($1, 0, index($1, "_node_")) }' > /tmp/monitored.txt
for NODE in `cat /tmp/monitored.txt`; do if grep -q $NODE /tmp/alive.txt; then echo $NODE alive; else echo $NODE dead; sudo rm -Rf ${NODE}_node_*; fi; done
View urbanspoon_reservations.rb
require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = 'EMAIL@provider.com'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }
@shtirlic
shtirlic / gist:2159621
Created Mar 22, 2012
Sinatra base url helper
View gist:2159621
def base_url
@base_url ||= "#{request.env['rack.url_scheme']}://#{request.env['HTTP_HOST']}"
end
@ahgittin
ahgittin / jsonball.rb
Created Feb 23, 2012
a jekyll tag to parse json files and objects for use as maps subsequently
View jsonball.rb
require 'json'
# JSON parser tag, creating map for use in jekyll markdown
# Alex.Heneveld @ Cloudsoft Corp (remove spaces and add the .com)
# Released under APL 2.0
# usage: {% jsonball varname from TYPE PARAM %}
#
# where TYPE is one of {data,var,file,page}, described below
@barn
barn / gist:1511082
Created Dec 22, 2011 — forked from jorilallo/gist:1509950
Grove's weechat config
View gist:1511082
# Add new server for organization YYYYYY
/server add grove YYYYYY.irc.grove.io/6667
/set irc.server.YYYYYY.password "YYYYYY"
# Set your username to BBBB
/set irc.server.YYYYYY.username "BBBB"
/set irc.server.YYYYYY.nicks "BBBB"
# Set your password
/set irc.server.YYYYYY.command "/msg NickServ identify xxxxxx"
@karmi
karmi / ElasticSearch.org.Website.Search.FieldNotes.markdown
Created Apr 8, 2011
Field notes gathered during installing and configuring ElasticSearch for http://elasticsearch.org
View ElasticSearch.org.Website.Search.FieldNotes.markdown

ElasticSearch.org Website Search: Field Notes

These are field notes gathered during installation of website search facility for the ElasticSearch website.

You may re-use it to put a similar system in place.

The following assumes:

@mipearson
mipearson / cfn_dsl_mockup.rb
Created Feb 28, 2011
Mockup for a DSL to generate Amazon CloudFormation configurations
View cfn_dsl_mockup.rb
# Based on half of https://s3.amazonaws.com/cloudformation-templates-us-east-1/WordPress-1.0.0.template
# Methods beginning with a lowercase letter are 'native' and have special behaviour.
# Methods beginning with an uppercase letter get literally transformed into JSON
templates do
Alarm do
EvaluationPeriods 1
Statistic 'Average'
Period 60
AlarmActions: ref('AlarmTopic')