Skip to content

Instantly share code, notes, and snippets.

@gkazior
gkazior / memusg
Last active August 29, 2015 14:12 — forked from netj/memusg
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <[email protected]>
# Created: 2010-08-16
set -um
# check input
[ $# -gt 0 ] || { sed -n '2,/^#$/ s/^# //p' <"$0"; exit 1; }
@gkazior
gkazior / cas-get.sh
Last active September 22, 2023 12:19 — forked from dodok1/cas-get.sh
#!/bin/bash
# Usage: cas-get.sh {url} {username} {password} # If you have any errors try removing the redirects to get more information
# The service to be called, and a url-encoded version (the url encoding isn't perfect, if you're encoding complex stuff you may wish to replace with a different method)
DEST="$1"
ENCODED_DEST=`echo "$DEST" | perl -p -e 's/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg' | sed 's/%2E/./g' | sed 's/%0A//g'`
#IP Addresses or hostnames are fine here
CAS_HOSTNAME=galaxy:9143
import java.security.SecureRandom;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.SecretKeyFactory;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
/*
* PBKDF2 salted password hashing.
* Author: havoc AT defuse.ca
@gkazior
gkazior / gist:78521d8f00e99cdb140f
Last active August 29, 2015 14:27 — forked from jtheoof/gist:2880413
pre-commit SVN hook to prevent a commit if Jenkins is building or build is broken
#!/bin/sh
# PRE-COMMIT HOOK
#
# The pre-commit hook is invoked before a Subversion txn is
# committed. Subversion runs this hook by invoking a program
# (script, executable, binary, etc.) named 'pre-commit' (for which
# this file is a template), with the following ordered arguments:
#
# [1] REPOS-PATH (the path to this repository)
@gkazior
gkazior / build.sbt
Last active September 22, 2015 09:13 — forked from seratch/build.sbt
Scala School - Testing with specs2 examples
organization := "com.gk"
name := "sandbox"
version := "0.1"
scalaVersion := "2.9.1"
libraryDependencies ++= Seq(
"junit" % "junit" % "4.9" % "test" withSources(),
@gkazior
gkazior / setenv.sh
Created January 12, 2016 16:06 — forked from terrancesnyder/setenv.sh
./setenv.sh - example setenv.sh with defaults set for minimal time spent in garbage collection
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
@gkazior
gkazior / gist:d3e63802cd57c7a162a7832cbe663d93
Created October 31, 2016 20:57 — forked from xeno-by/gist:2559714
Mixing in a trait dynamically
Answers http://stackoverflow.com/questions/10373318/mixing-in-a-trait-dynamically.
Compile as follows:
scalac Common_1.scala Macros_2.scala
scalac Common_1.scala Test_3.scala -cp <path to the result of the previous compilation>
Tested in 2.10.0-M3, will most likely not compile by the time 2.10.0 final is released, because we're actively rehashing the API.
However the principles will remain the same in the final release, so the concept itself is okay.
upd. Code updated for 2.10.0-M7.
upd. Code updated for 2.10.0-RC1.
@gkazior
gkazior / gist:faf427c48db385d7ecf3cc2a42dfcb0a
Created July 14, 2021 09:08 — forked from mcbrihk/gist:039d5f56ff31bcf27c47
Download the latest snapshot from nexus using wget
Download the latest snapshot from nexus using wget
From Maven 3, support for uniqueVersion is disabled and when you distribute your snapshots by publishing them on nexus you end up with snapshot names ending with timestamps. Suddenly your QA or Integration server scripts start failing if you are getting war file from nexus repository as there is no unique name now.
To get the latest version of snapshot you can use a service available from Nexus as
wget -O my-services.war http://nexus.myorg.net/nexus/service/local/artifact/maven/redirect?r=snapshots\&g=my.company.product.services\&a=my-services\&v=1.0-SNAPSHOT\&p=war
Where
r is the id of the repository
g is the group id
@gkazior
gkazior / spring-boot-security-saml-config-options.md
Created February 23, 2023 14:02 — forked from arcseldon/spring-boot-security-saml-config-options.md
spring-boot-security-saml configuration options.

Configuration Properties

Configuring your Service Provider through configuration properties is pretty straight forward and most configurations could be accomplished this way. The two limitations that exists are: You can only configure what is exposed as properties, obviously, and you cannot provide specific implementations or instances of the different Spring Security SAML classes/interfaces. If you need to provide custom implementations of certain types or a more dynamic configuration you'll need to use the Java DSL approach for that configuration, but as expressed before, you can configure as much as you can through properties, while using the DSL configuration for any dynamic or custom implementations configuration. You can mix the two flavors.
The following table shows all the available properties (Parsed from Spring Configuration Metadata file).

Key Default Value Description
saml.sso.default-failure-url /