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
export BASH_SILENCE_DEPRECATION_WARNING=1 | |
export LANG=en_US.UTF-8 | |
export LC_ALL=$LANG | |
genpasswd() { pwgen -Bs $1 1 |pbcopy |pbpaste; echo “Has been copied to clipboard” | |
} |
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
# Verify that you have access to your ec2 instance which has access to DB | |
ssh -i mykey.pem ec2-user@EC2_IP_ADDRESS | |
# Use tunnel port forwarding | |
ssh -i mykey.pem -L 3306:RDS-HOST-NAME:3306 ec2-user@IP-ADDRESS | |
# Connect to localhost |
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 javax.net.ssl.SSLSocket; | |
import javax.net.ssl.SSLSocketFactory; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
/** | |
* Establish a SSL connection to a host and port, writes a byte and | |
* prints the response. See | |
* @seen in http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services | |
*/ |
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
object DateTimeUtils { | |
import org.joda.time.format.ISODateTimeFormat | |
import org.joda.time.{DateTime, DateTimeZone, LocalDateTime, Period} | |
/** | |
* Round a given dateTime to next period. Examples | |
* <pre> | |
* 2018-04-10T09:59:59, 60m period -> 2018-04-10T10:00:00 | |
* 2018-04-10T10:00:00, 60m period -> 2018-04-10T10:00:00 | |
* 2018-04-10T10:00:01, 60m period -> 2018-04-10T11:00:00 | |
* </pre> |
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 akka.actor.ActorSystem | |
import akka.event.{Logging, LoggingAdapter} | |
import akka.stream.ActorMaterializer | |
import akka.stream.scaladsl.{BidiFlow, Flow, Sink, Source, Tcp} | |
import akka.util.ByteString | |
import akka.{Done, NotUsed} | |
import org.slf4j.LoggerFactory | |
import scodec.bits.ByteVector |
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
# Execute within the folder where pictures are located. | |
# This command will create a directory hierarchy by year/year-month | |
sudo apt-get install libimage-exiftool-perl | |
exiftool -d %Y/%Y-%m/%Y-%m-%d-%H:%M:%S.%%e "-filename<datetimeoriginal" -r . | |
# See more | |
# http://ninedegreesbelow.com/photography/exiftool-commands.html#move |
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
apply plugin: 'base' | |
configurations { | |
runtime | |
paxlogback | |
} | |
dependencies { | |
runtime "org.apache.karaf:apache-karaf:$karafVersion@zip" | |
paxlogback "ch.qos.logback:logback-core:$logbackVersion@jar" |
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
byte[] data = { 2, 3, 5, 7, 8, 9, 11, 12, 13 }; | |
int blockSize = 3; | |
int blockCount = (data.length + blockSize - 1) / blockSize; | |
byte[] range = null; | |
for (int i = 1; i < blockCount; i++) { | |
int idx = (i - 1) * blockSize; | |
range = Arrays.copyOfRange(data, idx, idx + blockSize); |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE log4j:configuration PUBLIC | |
"-//APACHE//DTD LOG4J 1.2//EN" "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd"> | |
<log4j:configuration debug="false"> | |
<appender name="console" class="org.apache.log4j.ConsoleAppender"> | |
<param name="target" value="System.out" /> | |
<param name="threshold" value="trace" /> | |
<layout class="org.apache.log4j.PatternLayout"> | |
<param name="ConversionPattern" value="[%t] %-5p %l %x - %m%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
<!-- UMLGraph doclet --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-javadoc-plugin</artifactId> | |
<version>2.9</version> | |
<executions> | |
<execution> | |
<phase>pre-integration-test</phase> | |
<goals> | |
<goal>javadoc</goal> |
NewerOlder