Skip to content

Instantly share code, notes, and snippets.

import optivo.core.spring.SpringHelper;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.util.Bytes;
import java.nio.ByteBuffer;
public abstract sealed class Action permits WriteOdif, CopyOcif, CopyOip, CopyResource, CopyJsps {
}
public final class WriteOdif extends Action { ... }
public final class CopyOcif extends Action { ... }
public final class CopyOip extends Action { ... }
public final class CopyResource extends Action { ... }
git-push-current() {
local branch_name="$(git branch --show-current)"
echo "---------------------------------------------"
echo "Pushing changes from '$branch_name' to origin"
echo "---------------------------------------------"
git push -u origin "$branch_name"
}
#
# .git/hooks/post-receive
#
#!/bin/bash
while read oldrev newrev ref
do
# only checking out the master (or whatever branch you would like to deploy)
if [[ $ref =~ .*/master$ ]];
then
@gdulus
gdulus / gist:8b1f5eea347ea8a42abe1976d134f1b7
Created July 23, 2018 12:09
VIM hidden characters highlighting
:set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<,space:.
@GrabResolver(name = "OJO", root = "https://oss.jfrog.org/artifactory/repo")
@GrabConfig(systemClassLoader = true)
@Grab("io.ratpack:ratpack-groovy:1.3.3")
@Grab("io.prometheus:simpleclient:0.0.21")
@Grab(group='io.prometheus', module='simpleclient_common', version='0.0.21')
@Grab(group = 'ch.qos.logback', module = 'logback-classic', version = '1.0.13')
import static ratpack.groovy.Groovy.ratpack
import io.prometheus.client.*
import io.prometheus.client.exporter.common.TextFormat
@gdulus
gdulus / slow.sh
Last active August 29, 2015 14:19
Simulate slow network connection
####
# tested on Ubuntu
####
# add 2min delay on eth0
sudo tc qdisc add dev eth0 root netem delay 120000ms
# remove delay
sudo tc qdisc del dev eth0 root netem
@gdulus
gdulus / gist:fa29d6f022edd7a4e717
Created January 28, 2015 09:48
FashionID ean generation
assertEquals('7711628332802', FashionIdUtils.calculateEan('162833280'))
assertEquals('7711000000008', FashionIdUtils.calculateEan('100000000'))
assertEquals('7719999999990', FashionIdUtils.calculateEan('999999999'))
assertEquals('7715000000006', FashionIdUtils.calculateEan('500000000'))
assertEquals('7711234567896', FashionIdUtils.calculateEan('123456789'))
assertEquals('7719876543216', FashionIdUtils.calculateEan('987654321'))
@gdulus
gdulus / gist:2101348d345d1df80d01
Last active August 29, 2015 14:11
GOL pseudocode
@EqualsAndHashCode
class Location {
public final int x
public final int y
}
@Grab( 'com.netflix.rxjava:rxjava-groovy:0.15.1' )
import groovy.transform.*
import rx.*
@CompileStatic
class RPSRX {
enum Result {
WIN, LOSE, DRAW
}