Skip to content

Instantly share code, notes, and snippets.

View zshamrock's full-sized avatar
:octocat:
Working

Aliaksandr Kazlou zshamrock

:octocat:
Working
View GitHub Profile
@zshamrock
zshamrock / range-drop-filter-jvm
Last active August 29, 2015 13:57
range->drop->filter in Scala, Clojure and Java 8
(0 until 12).drop(4).filter(_ % 2 == 0)
(->> (range 12) (drop 4) (filter #(= (mod % 2) 0)))
LongStream.range(0, 12).skip(4).filter((n) -> (n % 2) == 0)
// of course for the Java the whole story is:
import java.util.Arrays;
import java.util.stream.LongStream;
@zshamrock
zshamrock / bowling-kata.clj
Created May 20, 2014 09:08
Clojure Amsterdam meetup: bowling kata
(require '[clojure.test :refer [is]])
(defn rolls [pins]
(loop [p pins score 0]
(if (seq p)
(let [current-pins (first p)
next-pins (fnext p)
nnext-pins (fnext (next p))]
(cond
; strike
@zshamrock
zshamrock / .fonts.conf
Last active September 1, 2015 22:02 — forked from odony/.fonts.conf
Updated version of the fonts.conf file mentioned in http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/ in order to get rid of most of the fontconfig warnings (mostly the "Having multiple values in <test> isn't supported and may not work as expected")
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
Documented at
http://linux.die.net/man/5/fonts-conf
To check font mapping run the command at terminal
$ fc-match 'helvetica Neue'
@zshamrock
zshamrock / gist:1e4fae122427f107f710
Last active November 28, 2015 17:05
ansible-apt-deb-issue-steps
---
- name: download deb packages from the web
get_url: url={{ item.url }} dest=/tmp/{{ item.name }} force=no
with_items:
- { url: "http://download.cdn.viber.com/cdn/desktop/Linux/viber.deb", name: "viber.deb" }
- { url: "https://slack-ssb-updates.global.ssl.fastly.net/linux_releases/slack-desktop-1.2.6-amd64.deb", name: "slack.deb" }
- name: install downloaded deb packages
become: yes
apt: deb=/tmp/{{ item }}.deb state=present
@zshamrock
zshamrock / angular-bootstrap-templatePrefix.js
Last active December 11, 2015 21:29
AngularJS UI Bootstrap templatePrefix
angular.module("ui.bootstrap", ["ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.carousel","ui.bootstrap.collapse","ui.bootstrap.dialog","ui.bootstrap.dropdownToggle","ui.bootstrap.modal","ui.bootstrap.pagination","ui.bootstrap.tabs","ui.bootstrap.tooltip","ui.bootstrap.transition","ui.bootstrap.config"]);
angular.module("ui.bootstrap.config", []).value("ui.bootstrap.config", {templatePrefix: "template"});
...
angular.module('ui.bootstrap.pagination', ["ui.bootstrap.config"])
.directive('pagination', ["ui.bootstrap.config", function(uiBootstrapConfig) {
return {
General:
http://www.joelonsoftware.com/articles/Unicode.html
Unicode:
http://www.unicode.org/standard/WhatIsUnicode.html
http://www.unicode.org/history/unicode88.pdf
http://unicode.org/charts/
http://unicode.org/cldr/utility/character.jsp
https://en.wikipedia.org/wiki/List_of_Unicode_characters
package experiments.ignite;
import java.util.Arrays;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSet;
import org.apache.ignite.Ignition;
import org.apache.ignite.configuration.CollectionConfiguration;
import org.apache.ignite.lang.IgniteRunnable;
@zshamrock
zshamrock / checkstyle.xml
Created July 19, 2016 05:43
Checkstyle config
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the Google coding conventions from Google Java Style
that can be found at https://google.github.io/styleguide/javaguide.html.
Checkstyle is very configurable. Be sure to read the documentation at
@zshamrock
zshamrock / PubSub.java
Created September 7, 2016 15:58
stan: invalid start time exception
import java.io.IOException;
import java.util.concurrent.TimeoutException;
import io.nats.stan.Connection;
import io.nats.stan.ConnectionFactory;
class PubSub {
protected Connection createConnection(final String clientId) throws IOException, TimeoutException {
final io.nats.client.Connection natsConnection = new io.nats.client.ConnectionFactory("nats://127.0.0.1:4333")
.createConnection();
@zshamrock
zshamrock / influxdb-cli-walkthrough
Last active December 2, 2016 14:09
InfluxDB CLI Walk Through
##### connect
$ ./influxdb-cli.sh
Connected to http://localhost:8086 version 1.1.0
InfluxDB shell version: 1.1.0
##### help
> help
Usage:
 connect <host:port> connects to another node specified by host:port