Skip to content

Instantly share code, notes, and snippets.

-- Logs begin at Fri 2014-10-24 23:39:05 UTC, end at Sat 2014-10-25 16:44:02 UTC. --
Oct 25 16:42:32 localhost systemd-journal[84]: Runtime journal is using 6.2M (max allowed 49.9M, trying to leave 74.8M free of 492.8M available → current limit 49.9M).
Oct 25 16:42:32 localhost systemd-journal[84]: Runtime journal is using 6.2M (max allowed 49.9M, trying to leave 74.8M free of 492.8M available → current limit 49.9M).
Oct 25 16:42:32 localhost kernel: Initializing cgroup subsys cpuset
Oct 25 16:42:32 localhost kernel: Initializing cgroup subsys cpu
Oct 25 16:42:32 localhost kernel: Initializing cgroup subsys cpuacct
Oct 25 16:42:32 localhost kernel: Linux version 3.16.2+ (buildbot@ip-10-204-3-57) (gcc version 4.7.3 (Gentoo Hardened 4.7.3-r1 p1.4, pie-0.5.5) ) #2 SMP Thu Oct 16 01:11:04 UTC 2014
Oct 25 16:42:32 localhost kernel: Command line: init=/usr/lib/systemd/systemd console=ttyS0,115200n8 console=tty0 ro noswap cros_legacy root=LABEL=ROOT rootflags=subvol=root usr=gptprio: usr=PARTUUID=7130c94a-213a-4e5a-
var nsq = require('nsqjs');
function populate(done) {
var w = new nsq.Writer('10.0.0.101', 4150);
w.connect();
@dminkovsky
dminkovsky / gist:ce9ef79e784d24d70fc1
Last active August 29, 2015 14:11
Tmux static build
#!/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"
#!/bin/bash
HOST=172.17.42.1:9200
create() {
curl -XPUT "$HOST"/test
from django.db import models
from django.utils.decorators import wraps
from django.core.exceptions import ValidationError
def constraint(func):
@wraps(func)
def inner(*args, **kwargs):
func._is_constraint = True
return func(*args, **kwargs)
return inner
# MAC manipulators
alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`'
alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE'

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@dminkovsky
dminkovsky / Observations about binary and binary operations
Last active December 19, 2015 22:19
Round up to the next power of 2!
# Observations about binary and binary operations:
* Bitshifting by 1 either adds or subtracts a multiple of 2 from each factor of 2.
** Take, for example, the number 10 (decimal)
** 10 = 8 + 2 = 1*(2^3) + 0*(2^2) + 1*(2^1) + 0*(2^0), or 1010 in binary.
** If you shift each of these bits to the left by 1, you get 10100.
** This took each of the 1 bits (multiples of 2) in the binary representation and multplied each by 2:
*** 10100 is 1*(2^4) + 0*(2^3) + 1*(2^2) + 0*(2^1) + 0*(2^0) = 16 + 0 + 4 + 0 + 0 = 20.
*** Notice that 20 = 16 + 4 = 2*8 + 2*2 = 2*(8 + 2).
<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>
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?