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 User { | |
constructor(public name: string, public age: number, public city: string) {} | |
hashCode(): number { | |
let hash = 17; | |
hash = hash * 31 + this.name.hashCode(); | |
hash = hash * 31 + this.age; | |
hash = hash * 31 + this.city.hashCode(); | |
return hash; | |
} |
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 | |
# Script to (selectively) save/load multiple Docker images to/from a directory. | |
# Run ./save-load-docker-images.sh for help. | |
set -e | |
directory=$PWD | |
filter="" | |
compress=0 |
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 | |
JAILS=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'` | |
for JAIL in $JAILS | |
do | |
fail2ban-client status $JAIL | |
done |
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
# openssl s_client -connect carbon.hostedgraphite.com:20030 | |
CONNECTED(00000003) | |
depth=0 OU = Domain Control Validated, OU = PositiveSSL Wildcard, CN = *.hostedgraphite.com | |
verify error:num=20:unable to get local issuer certificate | |
verify return:1 | |
depth=0 OU = Domain Control Validated, OU = PositiveSSL Wildcard, CN = *.hostedgraphite.com | |
verify error:num=27:certificate not trusted | |
verify return:1 | |
depth=0 OU = Domain Control Validated, OU = PositiveSSL Wildcard, CN = *.hostedgraphite.com | |
verify error:num=21:unable to verify the first certificate |
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
import com.rabbitmq.client.ConnectionFactory; | |
import org.junit.Test; | |
public class ConnectionFactorySettersTest { | |
// considering the default value for handshakeTimeout is 10000 and the default value for connectionTimeout is 0 | |
// this test is failing | |
// if we set the connectionTimeout to a higher value than the default value of handshakeTimeout, the test will fail |
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/sh | |
set -e | |
set -x | |
dnf install -y fail2ban | |
curl -O https://get.docker.com/rpm/1.7.1/fedora-22/RPMS/x86_64/docker-engine-1.7.1-1.fc22.x86_64.rpm | |
rpm -i ./docker-engine-1.7.1-1.fc22.x86_64.rpm |
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
// | |
// named.conf | |
// | |
options { | |
listen-on port 53 { 127.0.0.1; }; | |
listen-on-v6 port 53 { ::1; }; | |
directory "/var/named"; | |
dump-file "/var/named/data/cache_dump.db"; | |
statistics-file "/var/named/data/named_stats.txt"; |
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
# /etc/fail2ban/jail.d/20-3proxy.conf | |
[3proxy] | |
enabled = true | |
filter = 3proxy | |
action = iptables[name=3proxy, port=3128, protocol=tcp] | |
logpath = /var/log/3proxy/3proxy.log* | |
maxretry = 3 | |
bantime = 3600 ; 1 hour | |
findtime = 3600 ; 1 hour |
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/sh | |
set -e | |
set -x | |
LOG_DIR=$HOME/graphite-volumes/var-log | |
DATA_DIR=$HOME/graphite-volumes/graphite-storage | |
VOLUMES_INIT_CONTAINER_NAME=graphite-volumes-init |
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
import lombok.extern.slf4j.Slf4j; | |
import org.junit.Test; | |
import org.mockito.invocation.InvocationOnMock; | |
import org.mockito.stubbing.Answer; | |
import rx.Observable; | |
import rx.Observer; | |
import rx.subjects.PublishSubject; | |
import rx.subjects.Subject; | |
import java.util.concurrent.CountDownLatch; |
NewerOlder