23:28:23 ~/data/dronze/keys $ aws iam upload-server-certificate \ --server-certificate-name dronze.com --certificate-body file://dronze_com_crt.pem \ --private-key file://dronze_com.key --certificate-chain file://dronze_com.ca-bundle \ --path /cloudfront/production/ { "ServerCertificateMetadata": { "ServerCertificateId": "ASCAIDAGVOZBPZ6VJTK7A", "ServerCertificateName": "dronze.com", "Expiration": "2017-05-22T23:59:59Z", "Path": "/cloudfront/production/", "Arn": "arn:aws:iam::705212546939:server-certificate/cloudfront/production/dronze.com", "UploadDate": "2016-05-22T06:30:39.224Z" } }
I wanted a place where I can post technical articles only. This is the place to find out my tips and tricks for being a Java web applications developer. I hope it helps you.
Saturday, May 21, 2016
Upload HTTPS Cert to Cloudfront
Monday, May 16, 2016
Connecting NAT to eth0 Docker (Expose to external IP)
http://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach
|
So I have a Nginx running inside a docker container, I have a mysql running on localhost, I want to connect to the MySql from within my Nginx. The MySql is running on localhost and not exposing a p...
|
Tuesday, May 03, 2016
How to set your log4j2 file to support the lambda appender.
Add to your gradle config:
compile 'com.amazonaws:aws-lambda-java-log4j:1.0.0'
and How to set your log4j2 file to support the lambda appender.
compile 'com.amazonaws:aws-lambda-java-log4j:1.0.0'
and How to set your log4j2 file to support the lambda appender.
Monday, May 02, 2016
Allowing profiles to be passed to bootRun
Allowing profiles to be passed to bootRun
$ ./gradlew bootRun -PjvmArgs="-Dspring.profiles.active=docker"
$ ./gradlew bootRun -PjvmArgs="-Dspring.profiles.active=docker"
Spring Profiles
Spring Profiles
Spring Profiles provide a way to segregate parts of your application configuration and make it only available in certain environments. Any
@Component
or @Configuration
can be marked with @Profile
to limit when it is loaded:@Configuration @Profile("production") public class ProductionConfiguration { // ... }
In the normal Spring way, you can use a
spring.profiles.active
Environment
property to specify which profiles are active. You can specify the property in any of the usual ways, for example you could include it in your application.properties
:spring.profiles.active=dev,hsqldb
or specify on the command line using the switch
--spring.profiles.active=dev,hsqldb
.Saturday, April 30, 2016
Amazon IP Ranges
Need to get IP ranges for whitelisting AWS? Here is a handy service.
https://ip-ranges.amazonaws.com/ip-ranges.json
https://ip-ranges.amazonaws.com/ip-ranges.json
Thursday, April 21, 2016
Installing Amazon Web Service Plugin for ElasticSearch
https://www.elastic.co/guide/en/elasticsearch/plugins/current/cloud-aws.html
The Amazon Web Service (AWS) Cloud plugin uses the AWS API for unicast discovery, and adds support for using S3 as a repository for Snapshot/Restore.
Installationedit
This plugin can be installed using the plugin manager:
sudo bin/plugin install cloud-aws
Trying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/repository-s3/2.3.1/repository-s3-2.3.1.zip ...
ERROR: failed to download out of all possible locations..., use --verbose to get detailed information
# bin/plugin install cloud-aws
-> Installing cloud-aws...
Trying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/cloud-aws/2.3.1/cloud-aws-2.3.1.zip ...
Downloading .............................................................................................................................................................................................................................................................................................................................................DONE
Verifying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/cloud-aws/2.3.1/cloud-aws-2.3.1.zip checksums if available ...
Downloading .DONE
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: plugin requires additional permissions @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.lang.RuntimePermission getClassLoader
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.
Continue with installation? [y/N]y
Installed cloud-aws into /usr/share/elasticsearch/plugins/cloud-aws
# service elasticsearch restart
[....] Stopping Elasticsearch Server:
Tuesday, April 19, 2016
Spring Boot CORS Not Working?
For the life of me I could not get the CORS Configuration for Spring Boot to write the needed headers to the response. I wrote my own filter that could read the CORS Config and used it in WebMVC Configuration to solve it.
Saturday, April 16, 2016
Monday, April 11, 2016
Rsync Without Git
Just add an explicit exclude for .git:
rsync -a --exclude='.git/' --include='*.c' --include='*.sh' --include='*/' --exclude='*' ~/c/ ~/Dropbox/Public/c
Another option is to create
~/.cvsignore
containing the following line along with any other directories you'd like to exclude:.git/
Tuesday, February 23, 2016
Thursday, February 18, 2016
Find In Files Recursively
Its helpful to be able to search for a string recursively in a directory. Here is the basic way:
grep -rnw '/path/to/somewhere/' -e "pattern"
-r
or -R
is recursive, -n
is line number and -w
stands match the whole word. -l
(lower-case L) can be added to just give the file name of matching files.
Along with these,
--exclude
or --include
parameter could be used for efficient searching. Something like below:grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"
This will only search through the files which have .c or .h extensions. Similarly a sample use of
--exclude
:grep --exclude=*.o -rnw '/path/to/somewhere/' -e "pattern"
Above will exclude searching all the files ending with .o extension. Just like exclude file it's possible to exclude/include directories through
grep --exclude-dir={dir1,dir2,*.dst} -rnw '/path/to/somewhere/' -e "pattern"--exclude-dir
and --include-dir
parameter; for example, the following shows how to integrate --exclude-dir
:Replace Recursively
find /home/www -type f -print0 | xargs -0 sed -i 's/subdomainA.example.com/subdomainB.example.com/g'
Wednesday, February 17, 2016
Truncating Git History
Look, sometimes you want to be a revisionist, and the only way to get rid of a pesky diff that is taking a lot of commit time is to truncate the commit log. So in the rare occasion you need to do it here is how.
Create a Truncate Script
Use the Commit Sha to Truncate To
source ~/data/bin/git-truncate a71f4386f9d5e3b707067e66fd5f76a1cc06c11c
Force the Push to Origin
git push origin master --force
Thursday, January 21, 2016
Basic Screen Commands
Screen is an extremely useful tool. When you dont want to make a service and just need something running in the background. Here are the basic screen commands.
Saturday, December 05, 2015
What IP addresses does GitHub use that I should whitelist?
Current IP Addresses
Github currently serves applications via the following IP address range. Note: This is in CIDR notation.
192.30.252.0/22
In order to access all of our services, please ensure that TCP ports 22, 80, 443, and 9418 are allowed via the IP range above.
These IPs may change (or be added to) in the future, and we will keep this page up to date.
Tuesday, December 01, 2015
Mockito All Bundles with Hamcrest = DERP.
This is just a rehash and rant related to the following excellent post at:
https://tedvinke.wordpress.com/2013/12/17/mixing-junit-hamcrest-and-mockito-explaining-nosuchmethoderror/
SHAME ON YOU
https://tedvinke.wordpress.com/2013/12/17/mixing-junit-hamcrest-and-mockito-explaining-nosuchmethoderror/
This is extremely discouraging that BOTH Junit and Mockito would embed hidden transitive dependencies that are almost impossible to find without looking into the contents of the jars in the classpath.This could be due to the fact that JUnit itself brings along its own version of Hamcrest as a transitive dependency. Now if you would be using JUnit 4.11 it would depending on Hamcrest 1.3 already – see here. Getting above error would be weird – since the describeMismatch method is present in org.hamcrest.Matcher interface. --Ted Vinke
SHAME ON YOU
Saturday, November 28, 2015
Filtering without Lambda or Java 8
I wanted a way to filter generally without using Lambda or Java 8.
Monday, November 16, 2015
File path from Class Relative
determine current filesystem location of executed class from the code of this class, in runtime, given that it's executed using
http://stackoverflow.com/questions/11747833/getting-filesystem-path-of-class-being-executed
java
command?http://stackoverflow.com/questions/11747833/getting-filesystem-path-of-class-being-executed
Sunday, November 15, 2015
Creating CORS Web Service for AngularJS
CORS is the ability to allow cross domains scripting. This can be important if you say want to host your website on S3 and have those pages access web services in EC2. I spent TONS of time trying to find how to configure AngularJS to use CORS and what I generally saw was people saying...
The example I am using is based on the Spring, Jersey, run-as-ajar example you can find on GitHub. So lets start with the server side then:
"You need to configure the server side for access control, not the client."Well that's not entirely true.
The example I am using is based on the Spring, Jersey, run-as-ajar example you can find on GitHub. So lets start with the server side then:
And here is the client side...
Saturday, November 07, 2015
Subscribe to:
Posts (Atom)