Skip to content

Instantly share code, notes, and snippets.

View bobvanderlinden's full-sized avatar

Bob van der Linden bobvanderlinden

  • The Netherlands
View GitHub Profile
@bobvanderlinden
bobvanderlinden / vscode-edit.sh
Created September 5, 2018 12:16
Edit files in vscode
#!/usr/bin/env bash
if [[ "$TERM_PROGRAM" = "vscode" ]]
then
code --reuse-window --wait "$@"
else
code --new-window --wait "$@"
fi
@bobvanderlinden
bobvanderlinden / README.md
Created September 3, 2018 12:01
Run commands on multiple servers in parallel

Usage

For example create a file with multiple servers:

echo 192.168.1.1 >> production_servers

Use the file with run_on to execute a command on all servers in parallel:

@bobvanderlinden
bobvanderlinden / README.md
Last active July 19, 2018 01:10
Run commands in parallel on different servers.

Create a file production that includes the server hostnames of production servers.

Then call for instance:

./run_on.sh production 'tail -f /var/log/nginx/access.log'
@bobvanderlinden
bobvanderlinden / sanitise_rubocop.sh
Created July 9, 2018 09:46
Fix Rubocop configuration by replacing the category of cops
#!/usr/bin/env bash
RUBOCOP_CONF="$1"
cat "$RUBOCOP_CONF" | \
sed -e 's|^DuplicatedGem|Bundler/DuplicatedGem|g' | \
sed -e 's|^InsecureProtocolSource|Bundler/InsecureProtocolSource|g' | \
sed -e 's|^OrderedGems|Bundler/OrderedGems|g' | \
sed -e 's|^DuplicatedAssignment|Gemspec/DuplicatedAssignment|g' | \
sed -e 's|^OrderedDependencies|Gemspec/OrderedDependencies|g' | \
sed -e 's|^RequiredRubyVersion|Gemspec/RequiredRubyVersion|g' | \
@bobvanderlinden
bobvanderlinden / README.md
Last active March 14, 2019 13:25
Update gem conservative for Ruby project

Usage

Make sure hub is installed and set up with your user credentials.

./update-gem.sh loofah "Resolves security vulnerability."
@bobvanderlinden
bobvanderlinden / pom.xml
Created May 27, 2018 14:43
go-offline failure case
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.maven.test</groupId>
<artifactId>main</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>My Dependency Test</name>
<description/>
@bobvanderlinden
bobvanderlinden / README.md
Last active May 18, 2018 12:02
Changelog in Markdown/JSON using Gradle

This Gradle script will generate a changelog.json file from a recent_changes.txt. The recent_changes.txt is a Markdown file where a developer can define the changelog and the Gradle task will convert it to JSON, so that it can be used inside a app or in later Gradle tasks. The resulting JSON structure can be found in example.changelog.json.

In addition, the changelog.json is reused for a whatsnew file that can be uploaded to Google Play using Google Play Publisher.

@bobvanderlinden
bobvanderlinden / build.gradle
Last active May 18, 2018 07:24
Publish APK over S3 using Gradle
buildscript {
dependencies {
classpath "com.amazonaws:aws-java-sdk:1.3.11"
}
}
def awsCredentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey)
// Publish APK and mapping file over SCP
android.applicationVariants.all { variant ->
@bobvanderlinden
bobvanderlinden / build.gradle
Created May 18, 2018 07:16
Publish APK over SSH using Gradle
ant.taskdef(
name: 'scp',
classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp',
classpath: configurations.sshAntTask.asPath
)
// Publish APK and mapping file over SCP
android.applicationVariants.all { variant ->
if (variant.buildType.name != "release") {
return
@bobvanderlinden
bobvanderlinden / build.gradle
Last active May 18, 2018 07:06
Git revision in Android build config using Gradle
def exec(String cmdline) {
def os = new ByteArrayOutputStream()
exec {
commandLine cmdline.split(" ")
standardOutput = os;
}
return os.toString().replaceAll('\\s', '')
}
def getGitSha() {