Skip to content

Instantly share code, notes, and snippets.

@kartikshah
kartikshah / settings.xml
Created July 22, 2016 20:49
Sample Maven configuration for server reference
<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 July 22, 2016 20:47
Sample Dockerfile for springboot app
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"]
@kartikshah
kartikshah / AppConfig.java
Created July 22, 2016 20:46
sample AppConfig
@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 July 22, 2016 20:44
SpringBoot Application Entry point
@SpringBootApplication
public class Application extends SpringBootServletInitializer
{
public static void main(String[] args)
{
SpringApplication.run(Application.class, args);
}
}
@kartikshah
kartikshah / pom.xml
Created July 22, 2016 20:38
docker maven plugin
<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 January 6, 2014 05:52
Autolayout and Orientation Blog entry - portrait gist
[_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 January 6, 2014 04:03
AutoLayout Constraints Blog - 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
#!/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 December 17, 2015 04:39
Point XCode to use newer SVN Client instead built-in one
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 February 17, 2012 22:44
Color output of linux tail command
$tail -100f /var/log/applications/application.log | awk '
/INFO/ {print "\033[32m" $0 "\033[39m"}
/Exception/ {print "\033[31m" $0 "\033[39m"}
'