This file contains hidden or 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
signInToken = { -> signInPost = new URL( "http://some.host.com:9000/signIn" ).openConnection(); message = '{ "username": "[email protected]", "password": "my-password", "rememberMe": false }'; signInPost.setDoOutput( true ); signInPost.setRequestProperty( "Content-Type", "application/json" ); signInPost.getOutputStream().write( message.getBytes( "UTF-8" ) ); signInPost.getResponseCode(); j = new groovy.json.JsonSlurper().parseText( signInPost.getInputStream().getText() ); j.resources.token } | |
userName = { u,t -> userGet = new URL( "http://some.host.com:9000/users/${u}" ).openConnection(); userGet.setRequestProperty( "Accept", "application/json" ); userGet.setRequestProperty( "X-Auth-Token", t ); userGet.getResponseCode(); j = new groovy.json.JsonSlurper().parseText( userGet.getInputStream().getText() ); j.resources.name } | |
g.V().limit(1).map { it -> userName( it.get().value( 'modifiedBy' ), signInToken() ) }.find() |
This file contains hidden or 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
signInPost = new URL( "http://some.host.com/login" ).openConnection() | |
message = '{ "username": "email", "password": "somepass", "rememberMe": false }' | |
signInPost.setDoOutput( true ) | |
signInPost.setRequestProperty( "Content-Type", "application/json" ) | |
signInPost.getOutputStream().write( message.getBytes( "UTF-8" ) ) | |
signInPost.getResponseCode() | |
j = new groovy.json.JsonSlurper().parseText( signInPost.getInputStream().getText() ) | |
j.resources.token |
This file contains hidden or 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
package com.intercax.groovy.jarSniffer | |
import java.util.jar.* | |
/** | |
* @author Lonnie VanZandt fluent version | |
* @author Ivan Krizsan original idea | |
*/ | |
// map of manually-resolved jars by their file names |
This file contains hidden or 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
#!/usr/bin/env ruby | |
if ARGV.length < 2 | |
puts "usage: #{$0} databag.json new_encrypted_databag.json [encrypted_data_bag_secret]" | |
exit(1) | |
end | |
databag_file = ARGV[0] | |
out_file = ARGV[1] | |
if ARGV.length >= 3 |
This file contains hidden or 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
// partition a collection of properties into the two sets | |
// of those that satisfy a predicate and those that do not | |
final ImmutableListMultimap<Boolean, Entry<String, Object>> propertiesPair = | |
Multimaps.index(domainModelDTO.getProperties().entrySet(), | |
Functions.forPredicate(predicateMethod())); | |
final FluentIterable<Entry<String, Object>> truePropertiesList = | |
FluentIterable.from( propertiesPair.get( true ) ); | |
final FluentIterable<Entry<String, Object>> falsePropertiesList = |
This file contains hidden or 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
public static Class<?> getTypeOfFirstParameter( final Method method ) | |
{ | |
final Type type = method.getGenericParameterTypes()[0]; | |
// Now get the parametrized type of the generic. | |
if (!(type instanceof ParameterizedType)) | |
{ | |
return method.getParameterTypes()[0]; | |
} |
This file contains hidden or 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
#!/usr/bin/zsh | |
# | |
# https://creativecommons.org/licenses/by/4.0/ | |
# Original Author: Lonnie VanZandt | |
# Creation Date: 04 November 2016 | |
# Summary: Simplify using Subversion SVN for Super Projects consisting of multiple independent sub-projects | |
# try to deduce the remote repo URL, superproject root, and local workspace root from available local files | |
SUPERURL=$'( [[ -d .svn ]] && echo `svn info --show-item repos-root-url` ) || echo "https://server.foo/svn/superproject"' | |
SUPERURL=`eval $SUPERURL` |
This file contains hidden or 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
param([String]$username, [String]$password, [String]$encoded_command, [String]$execution_time_limit) | |
# Try to get the Schedule.Service object. If it fails, we are probably | |
# on an older version of Windows. On old versions, we can just execute | |
# directly since priv. escalation isn't a thing. | |
$schedule = $null | |
Try { | |
$schedule = New-Object -ComObject "Schedule.Service" | |
} Catch [System.Management.Automation.PSArgumentException] { | |
powershell.exe -EncodedCommand $encoded_command |
This file contains hidden or 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
Vagrant.require_version ">= 1.7.4" | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.boot_timeout = 600 | |
config.omnibus.chef_version = :latest | |
config.vm.guest = :windows | |
config.windows.set_work_network = true | |
config.vm.synced_folder ".", "/vagrant", type: "rsync" | |
config.vagrant.host = :detect | |
config.vm.define "sl-win-obeo" do | cci | |
This file contains hidden or 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 'JSON' | |
require 'pp' | |
def hashList( list, value ) | |
head, *tail = list | |
head.sub!( /\[(.+)\]/, '\1' ) | |
case tail |