Instantly share code, notes, and snippets.

View MessageUpdater.js
export default class MessageUpdater {
constructor(id, environment) {
this._id = id;
this._environment = environment;
}
update({to, body}) {
const dirty = this._dirty();
View demoji.js
var fs = require('fs');
var iconv = require('iconv-lite');
var input = 'Kino - Le dernier des heroes.cue';
var output = 'Kino - Le dernier des heroes.utf8.cue';
fs.createReadStream(input)
.pipe(iconv.decodeStream('win1251'))
.pipe(iconv.encodeStream('utf8'))
.pipe(fs.createWriteStream(output));
View cheatsheet.txt
# Which cluster are you connect to?
$ kubectl cluster-info
$ kubectl config view context
For more detail: https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/
# What's running?
$ kubectl get --all-namespaces all
View gist:fb249c59a2446bf18f9a7b9a24ef7f50
users
.toStream()
.transform(() -> new Transformer<ByteString, Messages.User, KeyValue<ByteString, List<KeyValue<ByteString, Messages.User>>>>() {
private KeyValueStore<ByteString, Messages.User> store;
@Override
public void init(ProcessorContext context) {
store = (KeyValueStore<ByteString, Messages.User>) context.getStateStore("users-by-login-id-index");
}
View pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>project</groupId>
<artifactId>streams</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>streams</name>
View GraphQLPrinter.java
package pony;
import graphql.language.*;
import java.util.List;
public class GraphQLPrinter {
private int indentWidth = 4;
View gist:2acf0f35437b7daee2fc
2015-01-28 15:33:30 dimadima anyone here edit java with vim?
2015-01-28 15:33:37 surial dimadima: only complete blithering idiots.
2015-01-28 15:33:45 dimadima hmm
2015-01-28 15:33:56 surial vim is a great editor, but it's not intelligent, and java is a language that is extremely suitable to intelligent editing.
2015-01-28 15:34:04 surial In fact, you could go so far as to say that you NEED it to keep your sanity.
2015-01-28 15:34:06 dimadima i edit java with vim and i'm enjoying it well enough so far
2015-01-28 15:34:14 dimadima my one problem is that syntax highlighting
2015-01-28 15:34:17 freeone3000 Java IDEs are intelligent so Java developers don't have to be.
2015-01-28 15:34:27 freeone3000 dimadima: That's the one thing vim *does* do for Java code.
2015-01-28 15:34:27 surial dimadima: have you _used_ an intelligent editor?
View gist:29f6efb4c3dae1a3b078
#!/bin/bash
HOST=172.17.42.1:9200
create() {
curl -XPUT "$HOST"/test
View gist:ce9ef79e784d24d70fc1
#!/usr/bin/env bash
# From https://groups.google.com/forum/#!topic/coreos-dev/JAeABXnQzuE
pushd $(dirname $0) > /dev/null; CURRABSPATH=$(readlink -nf "$(pwd)"); popd > /dev/null; # Get the directory in which the script resides
set -x
MUSLPKG="musl:musl.tgz:http://www.musl-libc.org/releases/musl-1.1.4.tar.gz"
LEVTPKG="libevent:libevent2.tgz:https://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz"
TMUXPKG="tmux:tmux.tgz:http://iweb.dl.sourceforge.net/project/tmux/tmux/tmux-1.9/tmux-1.9a.tar.gz"
NCRSPKG="ncurses:ncurses.tgz:http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz"
View gist:0384c304ae9f2b384ed3
var nsq = require('nsqjs');
function populate(done) {
var w = new nsq.Writer('10.0.0.101', 4150);
w.connect();