Skip to content

Instantly share code, notes, and snippets.

# get setting
echo "stats settings" | nc localhost 11211
# get current memory usage
echo "stats" | nc -w 1 localhost 11211 | awk '$2 == "bytes" { print $2" "$3 }'
# start in verbose mode
/usr/local/bin/memcached -vv
# start with higher memory
@ondrej-kvasnovsky
ondrej-kvasnovsky / commands.sh
Created September 25, 2014 17:13
ZooKeeper commands
# Start server
zkServer.sh start
# Connect to server
zkCli.sh -server 127.0.0.1:2181
# Connect to server with authentification
@ondrej-kvasnovsky
ondrej-kvasnovsky / build.gradle
Created September 25, 2014 22:07
Gradle commands
// dependency tree for compile scope
gradle -q vsa-batch-processing-core:dependencies --configuration compile
DataSourceTransactionManagerAutoConfiguration
# Initializers
org.springframework.context.ApplicationContextInitializer
org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer
# Auto Configure
org.springframework.boot.autoconfigure.EnableAutoConfiguration
org.springframework.boot.autoconfigure.aop.AopAutoConfiguration
org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration
package com.company.cache
import com.google.common.base.Charsets
import com.google.common.hash.HashFunction
import com.google.common.hash.Hasher
import com.google.common.hash.Hashing
import com.vendavo.security.pseudo.SecUser
import org.springframework.cache.interceptor.KeyGenerator
import org.springframework.security.core.Authentication
import org.springframework.security.core.context.SecurityContextHolder
import groovy.sql.GroovyRowResult
import org.apache.commons.dbcp.BasicDataSource
import org.apache.commons.lang.StringEscapeUtils
import javax.sql.DataSource
import java.sql.ResultSet
import java.sql.Statement
/**
* Helper class to get data from database into a simple CSV without any extra formatting.
@ondrej-kvasnovsky
ondrej-kvasnovsky / gist:8bb4220a8d2c4b456914
Created December 15, 2014 21:21
GrailsConnectionPool
package com.vaadin.grails.datasource
import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool
import com.vaadin.grails.Grails
import org.codehaus.groovy.grails.commons.GrailsApplication
import java.sql.SQLException
class GrailsConnectionPool extends SimpleJDBCConnectionPool {
convexHull <- function(x)
{
indices <- chull(x[,1], x[,2])
points <- x[indices,]
points
}
convexHullFactory <- function()
{
list(name=convexHull,udxtype=c("transform"),intype=c("float","float"), outtype=c("float","float"), outnames=c("x","y"))
}
@ondrej-kvasnovsky
ondrej-kvasnovsky / History.java
Created June 18, 2015 01:32
Back and forward implementation
import java.util.ArrayDeque;
import java.util.Deque;
public class History<ENTITY> {
private Deque<ENTITY> backStack = new ArrayDeque<>();
private Deque<ENTITY> forwardStack;
private ENTITY current;
private int max;
@ondrej-kvasnovsky
ondrej-kvasnovsky / questions.txt
Created July 28, 2015 17:26
Software Craftsman Questions
Are we missing big pictue?
Are we missing the goal and crucial features of application?
Are we talking too much about big picture, goals, crucial features? Maybe we should just do it.