Skip to content

Instantly share code, notes, and snippets.

@talios
talios / gist:26e5e698e8e9e740bac1bed0d7b00f52
Created Sep 26, 2016
Oracle JDK crashes A LOT under the new macOS Siera release :( Or at least, IntelliJ IDEA does.
View gist:26e5e698e8e9e740bac1bed0d7b00f52
Process: idea [16532]
Path: /Users/USER/*/IntelliJ IDEA 2016.3 CE EAP.app/Contents/MacOS/idea
Identifier: com.jetbrains.intellij.ce-EAP
Version: EAP IC-163.SNAPSHOT (IC-163.SNAPSHOT)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: idea [16532]
User ID: 501
Date/Time: 2016-09-26 21:09:21.992 +1300
@talios
talios / netchat.hs
Created Jul 7, 2014
Network Chat in Haskell.
View netchat.hs
import Control.Concurrent
import Control.Concurrent.Chan
import Data.UUID
import Data.UUID.V4
import Network.Socket
import System.IO
data Message = Message UUID String
deriving (Show, Eq)
@talios
talios / gist:bdb79750df7e5cba6d54
Last active Aug 29, 2015
Simple implementation of the clojure "thread macro" or F# pipe operator...
View gist:bdb79750df7e5cba6d54
implicit class Piper[A](val a: A) extends AnyVal {
def |>[B](fn: (A => B)): B = fn(a)
}
def add5(a: Int) = a + 5
def times2(a: Int) = a * 2
def pipeit(a: Int) = {
(a |> add5
|> times2
@talios
talios / gist:9944948
Created Apr 2, 2014
Nashorn returns a different type for array lengths :(
View gist:9944948
$ /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/jrunscript
nashorn> [1,2,3].length
3
$ jrunscript
js> [1,2,3].length
3.0
@talios
talios / git-mvnrelease
Created Mar 21, 2014
Git command to wrap handling Apache Maven Releases with GitFlow
View git-mvnrelease
#!/bin/sh
if ! git diff-index --quiet HEAD --; then
echo "Git is dirty, clean up your mess!"
exit 1
fi
VERSION=`xml sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "/x:project/x:version" pom.xml`
BASEVERSION=${VERSION%-SNAPSHOT}
ARTIFACTID=`xml sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "/x:project/x:artifactId" pom.xml`
@talios
talios / gist:8907132
Created Feb 9, 2014
Strange git case sensitivity issue on OS/X
View gist:8907132
$ git branch -vv --no-merged
feature/JDK8 8e89521 First steps to JDK8
feature/jdk8 da4efaa WIP JDK8 Streams/Lambda Migration
$ git checkout feature/JDK8
Switched to branch 'feature/JDK8'
$ git checkout feature/jdk8
Switched to branch 'feature/jdk8'
View gist:7591336
whois microsoft.com Fri 22 Nov 2013 11:39:32 NZDT
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
MICROSOFT.COM.ZZZZZZZZZZZZZZZZZZZZZZ.IS.A.GREAT.COMPANY.ITREBAL.COM
MICROSOFT.COM.ZZZZZZZZZZZZZZZZZZZ.GET.ONE.MILLION.DOLLARS.AT.WWW.UNIMUNDI.COM
@talios
talios / git-mvnstage
Last active Dec 20, 2015
Stage an Apache Maven artifact release into a separate repository based on the git commits SHA1, so to allow for interim, unmerged dependencies to resolve for other users.
View git-mvnstage
#!/bin/sh
if ! git diff-index --quiet HEAD --; then
echo "Git is dirty, clean up your mess!"
exit 1
fi
VERSION=`xml sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "/x:project/x:version" pom.xml`
ARTIFACTID=`xml sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "/x:project/x:artifactId" pom.xml`
SHA1=`git rev-parse HEAD`
View TestJDK1 Output
int 1
int 2
int 3
int 4
int 5
View gist:3121945
A low maintenance chili recipe. Requires a big pot. Makes enough for loads of meals!
1 kilo of dry red kidney beans.
200 grams of dry black beans.
3 satchels of El Paso mixes (1 of taco, fajita, and burrito).
5 red peppers seeds removed.
3 red peppers with the seeds.
2 kilo diced beef.
3 cans of diced tomato.
3 or 4 cloves of garlic.
You can’t perform that action at this time.