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");
@MessagingGateway
public interface ApiGateway {
@Gateway(requestChannel = "requestChannel", replyChannel = "resultChannel")
Response handle(Request request);
}
@knalli
knalli / install-pcp.sh
Created October 30, 2015 18:11 — forked from johanstenberg92/install-pcp.sh
Install Performance Co-Pilot on Amazon Linux AMI
#!/bin/sh
if [ "$(id -u)" != "0" ]; then
echo "Sorry, you are not root."
exit 1
fi
if !(type pcp 2>/dev/null;) then
yum -y install git bison flex gcc-c++ perl-Tk-devel libmicrohttpd-devel
git clone git://git.pcp.io/pcp
'use strict';
let Service = require("HAP-NodeJS").Service;
let Characteristic = require("HAP-NodeJS").Characteristic;
let WebSocketClient = require('websocket').client;
class Utils {
assertUtf8Message(message) {
return new Promise((resolve, reject) => {
if (message.type === 'utf8') {
@knalli
knalli / 030_modify_plist.sh
Last active September 17, 2015 16:35 — forked from flpwgr/030_modify_plist.sh
Cordova Hook for App Transport Security iOS 9
#!/bin/bash
PLIST=platforms/ios/*/*-Info.plist
cat << EOF |
Add :NSAppTransportSecurity dict
Add :NSAppTransportSecurity:NSAllowsArbitraryLoads bool YES
EOF
while read line
do
@knalli
knalli / gist:27527a8841a878e1e0f8
Last active August 29, 2015 14:27
Jenkins, Xcode, Github, Testflight/Hockey on a Mac Mini
  • Buy a mac mini
  • Install 10.8
  • Create a user account for Jenkins
  • Install xcode
  • Turn on screen sharing
  • Turn off energy save sleeping
  • Login as your jenkins user
  • Use ssh-keygen to create a key for github
  • Create a github account for your build machine
  • Add the key to your build machine github account
@knalli
knalli / OraclePhysicalNamingStrategy.java
Created July 12, 2015 13:44
Hibernate 5 PhysicalNamingStrategy (untested), Java8
package de.knallisworld.hibernate5;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import java.util.Optional;
import java.util.StringTokenizer;