Simple collection of Groovy scripts to help me maintain some Jenkins systems.
See also https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console
Please comment & let me know if you have a fork / fixes you'd like to include.
import java.nio.ByteBuffer; | |
import java.nio.charset.Charset; | |
... | |
/** | |
Method Usage | |
ByteBuffer bf = string2ByteBuffer("test", Charset.forName("UTF-8")); | |
**/ |
# Linux | |
# add the following to "~/.gitconfig" file | |
[merge] | |
tool = intellij | |
[mergetool "intellij"] | |
cmd = /usr/local/bin/idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED") | |
trustExitCode = true | |
[diff] |
import java.io.IOException; | |
import javax.websocket.OnClose; | |
import javax.websocket.OnError; | |
import javax.websocket.OnMessage; | |
import javax.websocket.OnOpen; | |
import javax.websocket.Session; | |
import javax.websocket.server.ServerEndpoint; | |
import org.slf4j.Logger; |
Backup: | |
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql | |
Restore: | |
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres |
import com.google.common.collect.ForwardingSetMultimap; | |
import com.google.common.collect.LinkedHashMultimap; | |
import com.google.common.collect.Multimap; | |
import com.google.common.collect.SetMultimap; | |
import java.util.Locale; | |
import java.util.Map; | |
import java.util.Set; | |
/** SetMultimap decorator that coverts keys to lower case before delegation */ | |
public class CaseInsensitiveSetMultimap<V> extends ForwardingSetMultimap<String, V> { |
Obs: http://tinyurl.com/raml-file | |
----- | |
#%RAML 0.8 | |
baseUri: http://mocksvc.mulesoft.com/mocks/a296cd19-32ae-4c10-ba8a-ffb527bd4f24 | |
title: pagamentos | |
version: 1.0 | |
mediaType: application/json |
Simple collection of Groovy scripts to help me maintain some Jenkins systems.
See also https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console
Please comment & let me know if you have a fork / fixes you'd like to include.
$url = 'http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-windows-x64.exe' | |
$filename = $url.Substring($url.LastIndexOf("/") + 1); | |
$client = new-object System.Net.WebClient; | |
$client.Headers.Add("Cookie", "oraclelicense=accept-securebackup-cookie"); | |
$client.DownloadFile( $url, $filename ); | |
$result = (Start-Process -FilePath $filename -ArgumentList "/quiet /qn /norestart /l* jdk7_install.log" -Wait -Passthru).ExitCode; | |
echo $result; | |
Get-WmiObject -Class Win32_Product -Filter "Name LIKE '%java%SE Development Kit 7%'"; | |
# IdentifyingNumber : {64A3A4F4-B792-11D6-A78A-00B0D0170600} |
@Configuration | |
public class TestMongoConfig { | |
private static final MongodStarter starter = MongodStarter.getDefaultInstance(); | |
@SuppressWarnings("SpringJavaAutowiringInspection") | |
@Autowired | |
private MongoProperties properties; | |
@Autowired(required = false) | |
private MongoClientOptions options; |
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
# Install kernel extra's to enable docker aufs support | |
# sudo apt-get -y install linux-image-extra-$(uname -r) | |
# Add Docker PPA and install latest version | |
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |