Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
#/pdf-bulk-merge.sh.sh <INPUT_PATTERN e.g. in_%d.pdf> <OUTPUT_PATTERN e.g. out_%d.pdf> <PAGES> <JOBS e.g. $(ls -la INPUT_PATTERN* | wc -l)
INPUT_PATTERN=$1
OUTPUT_PATTERN=$2
PAGES=$3
JOBS=$4
echo -e "Starting to work on\ninputPattern\t${INPUT_PATTERN}\npages\t${PAGES}\njobs\t${JOBS}"
http://stackoverflow.com/questions/3936373/how-to-cut-out-and-save-a-rectangle-from-an-image
http://stackoverflow.com/questions/18189314/convert-a-pdf-file-to-image
#!/usr/bin/env groovy
pipeline {
agent any
tools {nodejs "latest"}
stages {
stage('preflight') {
steps {
echo sh(returnStdout: true, script: 'env')
sh 'node -v'
}
@giehlman
giehlman / eb-deploy-npm.sh
Last active November 21, 2017 14:42
Simple shell script to deploy a NodeJS application to elastic beanstalk (using .elasticbeanstalk/config.yml)
#!/usr/bin/env bash
msg=$(echo $(git log -1 --pretty=%B))
lbl=$(echo $(git log -1 --format='%H'))
echo "--- Deploying to EB ---"
echo "Message: " $msg
echo "Label: " $lbl
read -p "-----> DO YOU WANT TO DEPLOY? [Yy]es " -n 1 -r
if ! [[ $REPLY =~ ^[Yy]$ ]]
then
log4j.rootLogger=DEBUG, stdout, RollingFile
# Redirect log messages to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
# Define the file appender
log4j.appender.FILE=org.apache.log4j.FileAppender
@giehlman
giehlman / .htaccess
Created November 1, 2017 08:36
.htaccess snippet hiding some files, i.e. .git, .svn, etc.
RedirectMatch 404 (?i)\.git
RedirectMatch 404 (?i)\.svn
RedirectMatch 404 (?i)/\..+
RedirectMatch 404 (?i)\_.+
@giehlman
giehlman / lambda-publish.sh
Last active April 29, 2018 14:08
For gradle projects! Convenience script to build, pack and upload code to an AWS Lambda function, using the AWS CLI. For personal and experimental use only!
#!/usr/bin/env bash
#title : lambda-publish.sh
#description : For gradle or mvn projects! Convenience script to build, pack and upload code to an AWS Lambda function, using the AWS CLI. For personal and experimental use only!
#author : Christian-André Giehl <christian@emailbrief.de>
#date : 20170410
#version : 1.1
#usage : sh lambda-publish.sh
#==============================================================================
# Exits in case the supplied state is != 0. State is typically supplied via $?
@giehlman
giehlman / lambda-publish-npm.sh
Last active November 21, 2017 14:22
For npm projects! Convenience script to build, pack and upload code to an AWS Lambda function, using the AWS CLI. For personal and experimental use only!
#!/usr/bin/env bash
#title : lambda-publish-npm.sh
#description : For npm projects! Convenience script to build, pack and upload code to an AWS Lambda function, using the AWS CLI. For personal and experimental use only!
#author : Christian-André Giehl <christian@emailbrief.de>
#date : 20170410
#version : 1.1
#usage : sh lambda-publish-npm.sh
#==============================================================================
# Exits in case the supplied state is != 0. State is typically supplied via $?
@giehlman
giehlman / eb-deploy-gradle.sh
Created November 21, 2017 14:43
For gradle projects! Convenience script to build, pack and upload code to an AWS ElasticBeanstalk environment, using the AWS CLI 'eb' command. For personal and experimental use only!
#!/usr/bin/env bash
#title : eb-publish-gradle.sh
#description : For gradle projects! Convenience script to build, pack and upload code to an AWS ElasticBeanstalk environment, using the AWS CLI 'eb' command. For personal and experimental use only!
#prerequisites : AWS CLI with 'eb' cmd, Procfile, gradle project, .elasticbeanstalk/config.yml
#author : Christian-André Giehl <christian@emailbrief.de>
#date : 20170410
#version : 1.1
#usage : sh eb-publish-gradle.sh
#==============================================================================
@giehlman
giehlman / .bash_profile
Created December 3, 2017 13:27
Excerpt of my mostly used commands written in my bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
export AWS_PROFILE=internal-user
alias ls='ls -GFh'