Skip to content

Instantly share code, notes, and snippets.

@jehrhardt
jehrhardt / shared-mime-info-mac.sh
Created September 10, 2013 07:49
Set up shared mime info on Mac OS X via Homebrew
#!/bin/sh
# Install package shared-mime-info via Homebrew
brew install shared-mime-info
# Initialize shared mime info database
update-mime-database /usr/local/share/mime

Keybase proof

I hereby claim:

  • I am jehrhardt on github.
  • I am jehrhardt (https://keybase.io/jehrhardt) on keybase.
  • I have a public key ASBvdwoxc5ofY02pksHEurtNDEioiS9KrIJFCqqhURunkwo

To claim this, I am signing this object:

@jehrhardt
jehrhardt / KeyLengthDetector.java
Created March 15, 2013 06:23
Detect the allowed size of AES keys on the JVM. If the size is <= 256, it is limited. To fix it JCE unlimted stregth files are needed.
import javax.crypto.Cipher;
import java.security.NoSuchAlgorithmException;
public class KeyLengthDetector {
public static void main(String[] args) {
int allowedKeyLength = 0;
try {
allowedKeyLength = Cipher.getMaxAllowedKeyLength("AES");
} catch (NoSuchAlgorithmException e) {
@jehrhardt
jehrhardt / google-suggestions.rb
Last active February 26, 2019 09:38
Get suggestions from Google's completion API like http://ubersuggest.org
# Copyright © 2014 Jan Ehrhardt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@jehrhardt
jehrhardt / derjan.el
Last active February 16, 2017 15:20
My Emacs Prelude customizations - for Mac OS X
;;; derjan.el --- derjan's customizations of Emacs prelude
;; Copyright © 2013-2015 Jan Ehrhardt
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
@jehrhardt
jehrhardt / foo.clj
Last active October 29, 2016 07:10
simple clojure spec
(s/def ::bar (s/and int? even? #(> % 1000)))
(s/def ::foo (s/keys :req [::bar]))
(s/valid? ::foo {:bar 10000})
@jehrhardt
jehrhardt / Foo.scala
Last active October 29, 2016 07:05
simple case class
case class Foo(bar: Int)
@jehrhardt
jehrhardt / .zshrc
Last active October 9, 2016 07:23
# oh-my-zsh location
ZSH=$HOME/.oh-my-zsh
# Use lambda theme
ZSH_THEME="robbyrussell"
# Use plugins for typical tools
plugins=(brew git)
# Load oh-my-zsh

Collections

Introduction to collection API

Option

There are Some and None

val i = Some(1)
val j = None

Basics

Basics lesson of the workshop.

First step

println("Hello world")

Basic types