This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function docker-sh() { | |
local __PID="" | |
__PID=$(docker inspect --format "{{.State.Pid}}" $1) | |
local __EXIT=$? | |
if [ $__EXIT -eq 0 ]; then | |
nsenter --target $__PID --mount --uts --ipc --net --pid | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "centos65" | |
config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box" | |
config.vm.define "<your-vm-name>" do |vmname| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package iam.bivas.commons.bytes; | |
public enum ByteUnit { | |
BYTES { | |
@Override public double convert(double amount, ByteUnit unit) { return unit.toBytes(amount); } | |
@Override public double toBytes(double amount) { return amount; } | |
@Override public double toKilobytes(double amount) { return amount / DK; } | |
@Override public double toKibibytes(double amount) { return amount / BK; } | |
@Override public double toMegabytes(double amount) { return toKilobytes(amount) / DK; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Lua log module | |
@author Eliran Bivas | |
Usage: | |
local log = require "log" | |
log.debug("some debug") | |
log.info("some info") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package iam.bivas.commons.distance; | |
public enum DistanceUnit { | |
FEETS { | |
@Override | |
public double toMeters(final double units) { | |
return units / METER_TO_FEET; | |
} | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long now = System.currentTimeMillis(); | |
doSomeLongTask(); | |
long duration = System.currentTimeMillis() - now; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.adapter; | |
public interface ComplexNumber { | |
double real(); | |
double imaginary(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Foo { | |
Collection<Bar> getBars(); | |
Zoo getZoo(); | |
} | |
public interface Bar {} | |
public interface Zoo {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.cache; | |
import net.sf.ehcache.CacheException; | |
import net.sf.ehcache.Ehcache; | |
import net.sf.ehcache.Element; | |
import net.sf.ehcache.event.CacheEventListener; | |
final class NotNullCacheEventListener implements CacheEventListener { | |
public static final CacheEventListener INSTANCE = new NotNullCacheEventListener(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.factory; | |
public interface CarFactory { | |
Car createCar(); | |
} | |
public FordCarFactory implements CarFactory { | |
@Override | |
public Car createCar() { |
NewerOlder