Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View marcingrzejszczak's full-sized avatar
🌴
PTO till May 6th 2024

Marcin Grzejszczak marcingrzejszczak

🌴
PTO till May 6th 2024
View GitHub Profile
@marcingrzejszczak
marcingrzejszczak / deploy_version_to_static.sh
Created August 18, 2016 12:24
Automatically deploys the docs for the given tag to spring-cloud-static; requires /tmp/ghpages.sh file downloaded
#!/bin/bash -x
version=$1
git checkout v${version} && mvn -s .settings.xml clean install -P docs -DskipTests -pl docs && /tmp/ghpages.sh -v ${version} -d ~/repo/all-cloud/spring-cloud-static && git reset --hard
@marcingrzejszczak
marcingrzejszczak / retrieve_project_version.sh
Created August 12, 2016 08:41
Retrieves the Spring Cloud project's version
#!/usr/bin/env bash
source common.sh || source scripts/common.sh || echo "No common.sh script found..."
set -e
function print_usage() {
cat <<EOF
USAGE:
You can use the following options:
@marcingrzejszczak
marcingrzejszczak / finAndReplaceInJars.sh
Created June 28, 2016 22:08
Find and replace in JARs
#!/bin/sh
# From within a (bash) script you need to use double quotes instead of singel qoutes to expand the variable
newAddress="org.springframework.cloud.contract.verifier.dsl"
oldAddress="org.springframework.cloud.contract.spec"
repo="$HOME/repo/accurest"
currentDir=`pwd`
cd $repo
@marcingrzejszczak
marcingrzejszczak / replace_parent_version_in_pom.groovy
Last active April 21, 2016 10:18
Changes the version of parent
def cli = new CliBuilder(usage:'[options]', header:'Options:')
cli.with {
h longOpt: 'help', 'print this message'
p longOpt: 'pom', args:1, argName:'file', 'Path to POM file to change (required)'
v longOpt: 'version', args:1, argName:'version', 'Version of parent to use (required)'
}
def options = cli.parse(args)
if (!options) {
return
}
@marcingrzejszczak
marcingrzejszczak / gist:add8232542ac571c517e
Created February 9, 2016 12:51
When docker suddenly stops working via tcp...
#Enable the Remote API on a New Socket
# create file to make Docker available on a TCP socket on port 2375.
touch /etc/systemd/system/docker-tcp.socket
cat > /etc/systemd/system/docker-tcp.socket <<EOF
[Unit]
Description=Docker Socket for the API
@marcingrzejszczak
marcingrzejszczak / gist:1d8cb2ff0d8c79568378
Last active December 19, 2016 11:14
removeAllDockerInstances.sh
# Stop, remove containers/images
docker --tlsverify=false stop $(docker --tlsverify=false ps -a -q)
docker --tlsverify=false kill $(docker --tlsverify=false ps -a -q)
docker --tlsverify=false rm $(docker --tlsverify=false ps -a -q)
docker --tlsverify=false rmi $(docker --tlsverify=false images -q) -f
docker volume ls -qf dangling=true | xargs -r docker volume rm
docker volume rm $(docker volume ls -qf dangling=true)
docker kill $(docker ps -q)
@marcingrzejszczak
marcingrzejszczak / catDockerContainers.sh
Created December 18, 2015 23:28
Cat X lines of running docker containers
#!/bin/bash
NUMBER_OF_LINES_TO_LOG=200
docker ps | sed -n '1!p' > /tmp/containers.txt
while read field1 field2 field3; do
echo -e "\n\nContainer name [$field2] with id [$field1] logs: \n\n"
docker logs --tail=$NUMBER_OF_LINES_TO_LOG -t $field1
done < /tmp/containers.txt
@marcingrzejszczak
marcingrzejszczak / gist:8b4c3672714bfdbcd4c3
Created November 14, 2015 20:44
Grayscale for a webpage
/* http://superuser.com/questions/330830/how-to-turn-web-pages-in-browser-into-black-white-grayscale */
body {
/* IE */
filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
/* Chrome, Safari */
-webkit-filter: grayscale(1);
/* Firefox */
@marcingrzejszczak
marcingrzejszczak / clone-all-twitter-github-repos.sh
Last active September 5, 2015 20:00 — forked from caniszczyk/clone-all-twitter-github-repos.sh
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'