Skip to content

Instantly share code, notes, and snippets.

import java.util.*;
public class MagicalLand {
public static void main(String[] args) {
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
System.out.println("UNICORN #1: PAT THIS UNICORN ONCE");
}
}
public class MagicalLand {
public static void main(String[] args) {
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
System.out.println("UNICORN #1: PAT THIS UNICORN ONCE");
}
}
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
@huxi
huxi / PushoverAnnouncer.gradle
Last active February 19, 2016 12:30
Gradle announcer for https://pushover.net/Put this into ~/.gradle/init.d/PushoverAnnouncer.gradle
import org.gradle.api.plugins.announce.Announcer
import org.gradle.api.plugins.announce.internal.AnnouncingBuildListener
import org.slf4j.Logger
import org.slf4j.LoggerFactory
def pushoverAppToken = 'YourAppToken'
def pushoverUser = 'YourUserToken'
class PushoverAnnouncer implements Announcer {
private static final Logger logger = LoggerFactory.getLogger(PushoverAnnouncer)
@huxi
huxi / gist:9805666
Created March 27, 2014 11:40
OneName Verification
I am +huxi on OneName. #verifymyonename
https://onename.io/huxi
@huxi
huxi / gist:9807180
Created March 27, 2014 13:07
OneName Verification
I am +lilith on OneName. #verifymyonename
https://onename.io/lilith
@huxi
huxi / SynchronizedVsFairLock.java
Created April 30, 2014 13:44
Different synchronization variants compared
import java.util.concurrent.locks.*;
public class SynchronizedVsFairLock
{
public static void main(String args[])
throws InterruptedException
{
int delay=1;
if(args.length>0)
{
@huxi
huxi / gist:3323378214f2a4786220
Created May 28, 2014 11:15
gource 0.42 fails to build
==> Downloading https://github.com/acaudwell/Gource/releases/download/gource-0.42/gource-0.42.tar.gz
Already downloaded: /Library/Caches/Homebrew/gource-0.42.tar.gz
==> Verifying gource-0.42.tar.gz checksum
tar xf /Library/Caches/Homebrew/gource-0.42.tar.gz
==> ./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/gource/0.42 --without-x
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... build-aux/install-sh -c -d
checking for gawk... no
checking for mawk... no
@huxi
huxi / keybase.md
Created June 17, 2014 15:04
keybase.md

Keybase proof

I hereby claim:

  • I am huxi on github.
  • I am huxi (https://keybase.io/huxi) on keybase.
  • I have a public key whose fingerprint is AD87 86EE 62D6 4071 F7E8 A340 78A0 4B52 2984 7C26

To claim this, I am signing this object:

@huxi
huxi / BuildTimestamp.gradle
Created June 30, 2015 14:46
Simple Gradle build listener to print a "Finished at: " similarly to Maven after the build has finished. Put this file into the ~/.gradle/init.d directory.
import org.gradle.BuildAdapter
import java.text.SimpleDateFormat
class FinishedAtBuildListener extends BuildAdapter {
private SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS")
void buildFinished(BuildResult result) {
println "Finished at: "+formatter.format(new Date())
}
}