This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Utility class to handle checked exceptions in lambdas. | |
* <p> | |
* From <a href="http://stackoverflow.com/questions/27644361/how-can-i-throw-checked-exceptions-from-inside-java-8-streams">How can I throw CHECKED exceptions from inside Java 8 streams?</a>. | |
* This class helps to handle checked exceptions with lambdas. Example, with Class.forName method, which throws checked exceptions: | |
* </p> | |
* <pre> | |
* Stream.of("java.lang.Object", "java.lang.Integer", "java.lang.String") | |
* .map(rethrowFunction(Class::forName)) | |
* .collect(Collectors.toList()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove all containers | |
$ docker ps -q -a | xargs docker rm | |
or | |
$ docker rm `docker ps -aq` | |
# Delete all untagged images | |
$ docker rmi $(docker images | grep "^<none>" | awk '{print $3}') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import java.util.stream.IntStream; | |
import java.util.stream.Stream; | |
public class StreamUtil { | |
public static <T> Stream<List<T>> buffer(final List<T> source, final int length) { | |
if (length <= 0) throw new IllegalArgumentException("length = " + length); | |
int size = source.size(); | |
if (size <= 0) return Stream.empty(); | |
int fullChunks = (size - 1) / length; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT owner, table_name | |
FROM dba_tables | |
WHERE table_name like '%' | |
ORDER BY table_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Field; | |
public final class HackInmutable { | |
static final class InmutableEmployee { | |
private final int id; | |
private final String name; | |
private final Float salary; | |
private InmutableEmployee(final int id, final String name, final Float salary) { | |
this.id = id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on http://stackoverflow.com/questions/16466320/is-there-a-way-to-do-repetitive-tasks-at-intervals-in-golang | |
// Probably need to read more if some mutex if gotunite needs to access shared information. | |
package main | |
import ( | |
"log" | |
"time" | |
) | |
const ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
const ( | |
iterations = 5 | |
sleepTime = 500 * time.Millisecond |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize 4 | |
gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ vsize 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<style type="text/css"> | |
* { | |
margin: 0; | |
padding: 0; | |
} | |
html { | |
font-size: 62.5%; | |
box-sizing: border-box; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<style type="text/css"> | |
* { | |
margin: 0; | |
padding: 0; | |
font-size: 10px; | |
} | |
div { | |
display: flex; | |
flex-direction: row; |
OlderNewer