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
require 'uri' | |
require 'rest_client' | |
class DatabaseDetails | |
attr_accessor :database_name, :username, :password, :port | |
def initialize(database_name, username = nil, password = nil, port = nil) | |
@database_name = database_name | |
@username = username || 'admin' | |
@password = password || 'admin' |
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
task :upload_single_file do | |
# database connections | |
fuseki = FusekiConnection.new('glasgow-development', nil, nil, 3030) | |
stardog = StardogConnection.new('glasgow-development') | |
file = File.read("#{FusekiExport.template_app_root}/data_backup/postcodes.ttl") | |
graph_uri_string = "http://linked.glasgow.gov.uk/graph/postcodes" | |
# begin transaction with basic Stardog superuser creds | |
begin_transaction_response = RestClient.post "http://#{stardog.username}:#{stardog.password}@localhost:#{stardog.port}/#{stardog.database_name}/transaction/begin", {:accept => :text} |
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
#!/bin/bash | |
# This script originally took an argument passed to it, interpreted that as the docker to attach to, and called docker top on it. | |
# Unfortunately, monit does not support args for scripts: https://lists.nongnu.org/archive/html/monit-general/2012-11/msg00039.html | |
# As such, you'll need one of these per container. | |
sudo docker top <container-name>; | |
exit $?; |
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
# Async program checks using docker top wrapper script | |
# e.g. to check the status of a container named mongodb each cycle | |
# check program mongodb with path "/etc/monit/monit_mongodb_docker_top.sh" | |
check program <docker-container-name> with path </path/to/wrapper/script> | |
if status != 0 then alert |
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
#!/bin/bash | |
# Arg 1 is user | |
# Arg 2 is server | |
# Arg 3 is password | |
# Arg 4 is docker command to run | |
# e.g. ./simpledeploy.sh 'alex' 'build.example.com' 'foo' 'sudo docker run -d --name new-memcached alex/memcached' | |
# if you wanted to see docker ps at the end of the script, you could do: echo "sudo docker ps" >> ./tmp/deploy_command.sh | |
echo $4 > ./tmp/deploy_command.sh |
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
;; very lightly adapted from http://rosettacode.org/wiki/Walk_a_directory/Recursively#Clojure | |
;; run in the lein repl as it will cause emacs to go sad face | |
(use '[clojure.java.io]) | |
(defn walk [dirpath pattern] | |
(doall (filter #(re-matches pattern (.getName %)) | |
(file-seq (file dirpath))))) | |
;; print all the paths |
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
1. For a project, can pull down and provision other services in one (or a small number of) lines | |
2. Can make sure that each member of the team is using the same version of these services | |
3. Can revert to or specify specific versions of services (e.g. for debugging, pairing etc) | |
4. Should have repeatable configuration that's easy to set up and needs little to no updating | |
5. Can make sure CI can provision using these versions in the same way and run tests, etc | |
6. Ideally should also be a simple way of starting these services, stopping them, getting logs for debugging, etc | |
7. Should not disrupt workflow of developers on the codebase (e.g. lots of extra mental overhead, extra steps to commit code, etc) | |
8. Should be easy to maintain going forward; crucially, should be difficult to break | |
9. Should be easy for developers to repackage a build, outside of jenkins | |
10. Should be able to get Jenkins to build staging versions of all the sites |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> | |
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script> | |
<style type="text/css"> | |
textarea#text { | |
outline: none; | |
border:none; |
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
require 'rubygems' | |
require 'oauth' | |
require 'json' | |
#install the above dependencies with rubygems - | |
#gem install dependency | |
#You will need these for OAuth. The second of each should be your secret value. The naming simply refects the order in the two OAuth class constructors. Create an app in the Twitter dev centre to get these values, making sure you select the option for 'read and write access'. | |
CONSUMER_KEY1 = "" #consumer key | |
CONSUMER_KEY2 = "" #consumer secret |
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
require 'rubygems' | |
require 'oauth' | |
require 'json' | |
#You will need these for OAuth. The second of each should be your secret value. The naming simply refects the order in the two OAuth class constructors. | |
CONSUMER_KEY1 = "" #consumer key | |
CONSUMER_KEY2 = "" #consumer secret | |
ACCESS_TOKEN1 = "" #access token | |
ACCESS_TOKEN2 = "" #access secret |
OlderNewer