Skip to content

Instantly share code, notes, and snippets.

@knalli
knalli / Readme.md
Last active September 2, 2020 10:12
Mongo UUID Type 3 <-> Type 4 Conversion
@knalli
knalli / Jenkinsfile
Last active April 27, 2020 08:10
Jenkinsfile with custom function for reading a file as environment variables
node {
stage('Demo') {
echo "Hello world"
withConfigEnv('env') {
echo "Here we go:"
sh "printenv"
}
}
}
# /etc/systemd/system/jstatd.service
#
# Install:
# - Put this file on /etc/systemd/system/jstatd.service
# - Rewrite <host ip>
#
# Usage:
# sudo systemctl enable jstatd
# sudo systemctl start jstatd
#
@knalli
knalli / CheckActiveDirectoryConnectionViaLdap_ForSpringSecurity.java
Created January 17, 2018 17:36
Checks whether the given setup with user credentials are valid for authentication (quick check)
import javax.naming.NamingException;
import javax.naming.spi.NamingManager;
import java.util.Hashtable;
public class CheckActiveDirectoryConnectionViaLdap_ForSpringSecurity {
public static void main(String... args) throws NamingException {
Hashtable<String, String> table = new Hashtable<>();
table.put("java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory");
table.put("java.naming.provider.url", "ldap://$HOST:389");
@knalli
knalli / gist:bdebd651a0adab2da457
Created July 29, 2014 19:52
OS X & Java: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
# Sometimes some Java applications will not work because the internal references to the trusted libs are broken.
# Unless '/System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security' does not exist, this should help
$ sudo mkdir -p /System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security
$ cd /System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security
$ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/security/cacerts
$ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/security/blacklist
$ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/security/trusted.libraries
@MessagingGateway
public interface ApiGateway {
@Gateway(requestChannel = "requestChannel", replyChannel = "resultChannel")
Response handle(Request request);
}
@knalli
knalli / index.coffee
Last active January 4, 2016 20:49
Semver (http://semver.org/) is only a promise. And this is the nerdy showcase. :)
maybe = ->
console.log 'Maybe?'
require('./semver-is-a-promise')(require('./package.json')).then(maybe)
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
<div class="dialog dialog-yesno">
<header>
<h1>Are you sure deleting the internet?</h1>
</header>
<button>No</button>
<button>Yes</button>
</div>
@knalli
knalli / example_dialog.js
Last active December 15, 2015 15:28
Example of a dialog directive
angular.module('app').directive('dialog', function(){return{
template : '<div class="dialog dialog-{{type}}">'+
'<header><h1>{{title}}</h1></header>'+
'<button>No</button><button>Yes</button>'+
'</div>',
restrict: 'E',
replace: true,
scope: {
'title' : '@',
'type' : '@'