Skip to content

Instantly share code, notes, and snippets.

@kartikshah
kartikshah / settings.xml
Created Jul 22, 2016
Sample Maven configuration for server reference
View settings.xml
<servers>
<server>
<id>docker-hub</id>
<username>your_user_name</username>
<password>your_password</password>
<configuration>
<email>your_email</email>
</configuration>
</server>
@kartikshah
kartikshah / Dockerfile
Created Jul 22, 2016
Sample Dockerfile for springboot app
View Dockerfile
FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
ADD options-analyzer-1.0-SNAPSHOT.jar app.jar
RUN sh -c 'touch /app.jar'
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"]
View AppConfig.java
@Configuration
@ComponentScan(basePackageClasses = Application.class)
public class AppConfig
{
@Bean
public RestTemplate restTemplate() {
RestTemplate restTemplate = new RestTemplate(httpRequestFactory());
List<HttpMessageConverter<?>> converters = restTemplate.getMessageConverters();
for (HttpMessageConverter<?> converter : converters) {
if (converter instanceof MappingJackson2HttpMessageConverter) {
@kartikshah
kartikshah / SpringBootApplication.java
Created Jul 22, 2016
SpringBoot Application Entry point
View SpringBootApplication.java
@SpringBootApplication
public class Application extends SpringBootServletInitializer
{
public static void main(String[] args)
{
SpringApplication.run(Application.class, args);
}
}
@kartikshah
kartikshah / pom.xml
Created Jul 22, 2016
docker maven plugin
View pom.xml
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.10</version>
<configuration>
<serverId>docker-hub</serverId>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
@kartikshah
kartikshah / AutolayoutPortraitConstraints
Created Jan 6, 2014
Autolayout and Orientation Blog entry - portrait gist
View AutolayoutPortraitConstraints
[_containerView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"|-[_leftOrTopView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_leftOrTopView)]];
[_containerView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"|-[_rightOrBottomView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_rightOrBottomView)]];
[_containerView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[_leftOrTopView]-[_rightOrBottomView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_leftOrTopView, _rightOrBottomView)]];
[_containerView addConstraint: [NSLayoutConstraint constraintWithItem:_leftOrTopView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:_rightOrBottomView attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0 ]];
[_containerView addConstraint: [NSLayoutConstraint constraintWithItem:_leftOrTopView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:_rightOrBottomView attribute:N
@kartikshah
kartikshah / Landscape Constraints
Created Jan 6, 2014
AutoLayout Constraints Blog - Landscape Constraints
View Landscape Constraints
[_containerView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"|-[_leftOrTopView]-[_rightOrBottomView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_leftOrTopView, _rightOrBottomView)]];
[_containerView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[_leftOrTopView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_leftOrTopView)]];
[_containerView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[_rightOrBottomView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_rightOrBottomView)]];
[_containerView addConstraint: [NSLayoutConstraint constraintWithItem:_leftOrTopView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:_rightOrBottomView attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0 ]];
[_containerView addConstraint: [NSLayoutConstraint constraintWithItem:_leftOrTopView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:_rightOrBottomView attribute
View git-svn-co
#!/bin/bash
set -e
COMMITS="5"
if [ "$1" == "" ]; then
echo ""
echo "WARN : NO ARGUMENTS FOUND."
echo ""
echo "syntax:"
@kartikshah
kartikshah / xcode-svn-client-latest-version.sh
Last active Dec 17, 2015
Point XCode to use newer SVN Client instead built-in one
View xcode-svn-client-latest-version.sh
cd /Applications/Xcode.app/Contents/Developer/usr/bin/
mkdir backup-svn
mv svn* backup-svn
#change directory to where you have the latest svn version
ln -s /opt/local/bin/svn* ./
@kartikshah
kartikshah / tail-color.sh
Created Feb 17, 2012
Color output of linux tail command
View tail-color.sh
$tail -100f /var/log/applications/application.log | awk '
/INFO/ {print "\033[32m" $0 "\033[39m"}
/Exception/ {print "\033[31m" $0 "\033[39m"}
'
You can’t perform that action at this time.