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
#! /usr/bin/env bash | |
set -e | |
if [[ $(docker inspect -f '{{ range .Mounts }}{{ if eq .Name "zk-data" }}{{ .Destination }}{{ end }}{{ end }}' zookeeper) == '/var/lib/zookeeper' ]]; then | |
VID1=$(docker inspect -f '{{ range .Mounts }}{{ if eq .Destination "/var/lib/zookeeper" }}{{ .Source }}{{ end }}{{ end }}' zookeeper) | |
VID2=$(docker inspect -f '{{ range .Mounts }}{{ if eq .Destination "/var/lib/zookeeper/data" }}{{ .Source }}{{ end }}{{ end }}' zookeeper) | |
rm -fr $VID1 | |
cp -R $VID2 $VID1 | |
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
#! /usr/bin/env python2 | |
import argparse | |
from kazoo.client import KazooClient | |
from kazoo.exceptions import NoNodeError | |
ZK_DEFAULT_HOST = 'localhost:2181' | |
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 helpers; | |
import com.google.maps.PendingResult; | |
import java.util.concurrent.CompletableFuture; | |
/** | |
* Helper methods for Google Maps API. | |
*/ | |
public final class GoogleMapsApiHelper { |
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 foo; | |
import com.github.springtestdbunit.TransactionDbUnitTestExecutionListener; | |
import com.github.springtestdbunit.annotation.DbUnitConfiguration; | |
import org.junit.runner.RunWith; | |
import org.springframework.boot.test.SpringApplicationConfiguration; | |
import org.springframework.test.annotation.DirtiesContext; | |
import org.springframework.test.context.TestExecutionListeners; | |
import org.springframework.test.context.TestPropertySource; | |
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
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
titleize() { | |
local title=$@ | |
local title_arr=( $title ) | |
echo "${title_arr[*]^}" | |
} | |
camelize() { | |
local title=`titleize $@` | |
echo "${title// /}" | |
} |
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
# ... | |
location = /myip { | |
add_header Content-Type text/plain; | |
return 200 "$remote_addr\n"; | |
} | |
# ... |
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
class Bar < ActiveRecord::Base | |
attr_accessible :name | |
has_many :bazs, autosave: true | |
end |
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
#! /usr/bin/escript | |
-include_lib("hackney/include/hackney.hrl"). | |
-include_lib("public_key/include/public_key.hrl"). | |
main([]) -> | |
ok = hackney:start(), | |
{ok, 200, _, C} = hackney:request(get, <<"https://friendpaste.com">>, [], <<>>, []), | |
{ok, Cert} = ssl:peercert(C#client.socket), | |
DecodedCert = public_key:pkix_decode_cert(Cert, plain), |
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
#! /usr/bin/escript | |
-include_lib("hackney/include/hackney.hrl"). | |
-include_lib("public_key/include/public_key.hrl"). | |
main([]) -> | |
ok = hackney:start(), | |
{ok, 200, _, C} = hackney:request(get, <<"https://friendpaste.com">>, [], <<>>, []), | |
{ok, Cert} = ssl:peercert(C#client.socket), | |
DecodedCert = public_key:pkix_decode_cert(Cert, plain), |
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
class MaskFormatter(object): | |
def __init__(self, **variables): | |
self.variables = variables | |
self.formatter = string.Formatter() | |
def format(self, match_pattern, strip_length, prepend_prefix): | |
mask_parts = [] | |
for literal_text, field_name, _, _ in self.formatter.parse(prepend_prefix): | |
if literal_text: |
NewerOlder