Skip to content

Instantly share code, notes, and snippets.

@friek
friek / module.xml
Created June 12, 2014 08:36
Wildfly MySQL XA configuration
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file needs to be placed in wildfly_dir/modules/system/layers/base/com/mysql/main.
The mysql connector needs to go there as well.
-->
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.25.jar"/>
</resources>
<dependencies>
@friek
friek / pem_to_keystore.sh
Created June 13, 2014 19:28
Converting a PEM certificate to a Java keystore
#!/bin/bash -x
# Extracted from http://stackoverflow.com/a/8224863/578745
# Name this whatever you want it to be named in the key store.
alias_name="localhost"
# First convert the pem to pkcs12 format
# The CA file contains the public certificate of the CA
# which signed the certificate. It apparently needs a name.
openssl pkcs12 \

Keybase proof

I hereby claim:

  • I am friek on github.
  • I am johanmulder (https://keybase.io/johanmulder) on keybase.
  • I have a public key whose fingerprint is A8A4 FB7C 97CD BE67 D2B6 55A2 697A 9950 066D 90F3

To claim this, I am signing this object:

@friek
friek / designer.html
Last active August 29, 2015 14:11
designer
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
@friek
friek / designer.html
Last active August 29, 2015 14:11
designer
<link rel="import" href="../core-pages/core-pages.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@friek
friek / Resource.java
Created January 15, 2015 20:23
Minimal jaxrs setup
import javax.persistence.*;
@Entity
public class Resource
{
@Id
private int id;
private String value;
public int getId()
@friek
friek / CURRENT_TIME_MILLIS.sql
Created January 27, 2015 12:44
MySQL to return the current timestamp + milliseconds
CREATE FUNCTION CURRENT_TIME_MILLIS ()
RETURNS BIGINT
LANGUAGE SQL
SQL SECURITY INVOKER
BEGIN
DECLARE _time BIGINT;
select conv(concat(substring(uid,16,3), substring(uid,10,4), substring(uid,1,8)), 16,10)
div 10000 - (141427 * 24 * 60 * 60 * 1000) into _time
from (select uuid() uid) as alias;
@friek
friek / .editrc
Created May 26, 2015 15:31
MySQL client .editrc for backwards compatibility with libreadline
# Ctrl+W to delete the previous word
bind "^W" ed-delete-prev-word
# Ctrl+U to delete the current line contents
bind "^U" vi-kill-line-prev
# Ctrl+R to search the query history
bind "^R" em-inc-search-prev
# Ctrl+Left Arrow to go the previous word
bind "\e[1;5D" vi-prev-word
# Ctrl+Right Arrow to go to the next word
bind "\e[1;5C" vi-next-word
@friek
friek / FileReader.java
Created July 1, 2015 09:12
One liner for reading a file in Java.
package file;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
public class FileReader
{
public static void main(String[] args) throws IOException
@friek
friek / pywebserv.py
Created July 6, 2015 08:19
Python SimpleHTTPServer with address reusage
#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
import sys
import os
import getopt
def main(argv):
try: