Skip to content

Instantly share code, notes, and snippets.

Blazing a trail the likes of which has never been seen.

Rory Bramwell rbramwell

Blazing a trail the likes of which has never been seen.
View GitHub Profile
View MyRetryPolicy.scala
class MyRetryPolicy(maxRetries: Int) extends RetryPolicy {
override def onReadTimeout(statement: Statement,
cl: ConsistencyLevel,
requiredResponses: Int,
receivedResponses: Int,
dataRetrieved: Boolean,
nbRetry: Int): RetryDecision = {
if (nbRetry < maxRetries) RetryDecision.retry(cl) else RetryDecision.rethrow()
rbramwell /
Last active Aug 29, 2015 — forked from joyrexus/
REST basics

Basics of RESTful API design

  • Your API should be designed around the idea of resources.

  • Resources represent things (nouns) and not behaviors (verbs).

  • Each resource should have a canonical/unique url (api/users/bill, api/users/mary).

  • Return all resource properties in the return payload.

View ConfigureWsMan.ps1
# Get a list of trusted hosts
Get-Item WSMan:\localhost\Client\TrustedHosts
# Note that these commands don't create a list of trusted hosts, it simply replaces the trusted host with what you set via the command. If you need to add multiple hosts, they need to be comma seperated
# Trust all computers in a domain
Set-Item WSMan:\localhost\Client\TrustedHosts *
# Turst a single machine
Set-Item WSMan:\localhost\Client\TrustedHosts -Value myserver
#!/bin/bash -e
# Argument = -h -v -i groupId:artifactId:version -c classifier -p packaging
#shopt -o -s xtrace
# Define Nexus Configuration
NEXUS_BASE= #this URL shouldn't end in a /
jeremyjarrell / Prefix migrations with timestamp Ant task
Last active May 15, 2017
An Ant task that prefixes new SQL migration files with a timestamp precise to milliseconds. The following usage will add a prefix to any SQL file in a hardcoded directory that does not begin with an number and double leading underscore: $ ant prefix-new-migrations
View Prefix migrations with timestamp Ant task
<project name="migrations">
<target name="prefix-new-migrations">
<foreach target="rename-file" param="the-file">
<!-- The hardcoded directory containing the migrations -->
<fileset dir="./src/db/migrations" casesensitive="no" includes="*.sql">
<!-- Exclude any migration files which have already been prefixed -->
<filename regex="\d+__.*" casesensitive="true"/>
beccam /
Last active Jul 21, 2017
Getting Started with Apache Cassandra and Java Part II
import com.datastax.driver.core.*;
public class GettingStartedTwo {
public static void main(String[] args) {
Cluster cluster;
Session session;
ResultSet results;
Row rows;
vijayjt / Get-AzureIPRangesXMLFile.ps1
Last active Jul 31, 2017
PowerShell function to download the Azure Public IP Ranges file and save it locally
View Get-AzureIPRangesXMLFile.ps1
Function Get-AzurePublicIPRangesXMLFile
This function downloads the Azure IP ranges XML file to the current directory or a specified path.
This function downloads the Azure IP ranges XML file to the current directory or a specified path.
An optional parameter that is the URL to the Azure IP range XML file download page.
.PARAMETER DestinationPath
aj-jester / sorted_json.rb
Last active Jan 18, 2018
Puppet parser function that takes unsorted hash and outputs sorted JSON object.
View sorted_json.rb
require 'json'
module JSON
class << self
@@loop = 0
def sorted_generate(obj)
drhuffman12 / gem-fetch-dependencies.rb
Last active Apr 12, 2018 — forked from Milly/gem-fetch-dependencies
Extend 'gem fetch' command. Fetch all dependencies. Handles OS (Windows vs non-Windows) and Ruby Platform (JRuby vs Ruby).
View gem-fetch-dependencies.rb
# Ruby:
ruby gem-fetch-dependencies.rb fetch <gem_name> --dependencies
# JRuby:
jruby gem-fetch-dependencies.rb fetch <gem_name> --dependencies
marvin / gist:1017389
Created Jun 9, 2011
ruby regular expression validate http, email, ip, netmask, ip in range
View gist:1017389
validate email: /\A([\w\.\-\+]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
validate url: ^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/ix
validate ip: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i
validate ip ranges: /^\b(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-4]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9]?)\b$/i
validate netmask: /^(((128|192|224|240|248|252|254)\.0\.0\.0)|(255\.(0|128|192|224|240|248|252|254)\.0\.0)|(255\.255\.(0|128|192|224|240|248|252|254)\.0)|(255\.255\.255\.(0|128|192|224|240|248|252|254)))$/i