Skip to content

Instantly share code, notes, and snippets.

@mizanRahman
mizanRahman / config-mirror.yml
Created May 3, 2017 20:50
docker registry and mirror setup
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
@RunWith(MockitoJUnitRunner.class)
public class TokenAuthenticationFilterTest {
private static final String token = "260bce87-6be9-4897-add7-b3b675952538";
private static final String testUri = "/testUri";
@Mock
private SecurityService securityService;
@InjectMocks
@mizanRahman
mizanRahman / build.gradle
Last active October 18, 2016 19:12
Spring Boot files
/*
** When a spring boot project need to build as war
*/
apply plugin: 'war'
war {
baseName = 'myapp'
version = '0.5.0'
}

I want to wipe out my local changes that are not committed yet:

  1. wipe out all uncommitted changes that made:

    git checkout .

  2. But it will not wipe out new files that were not committed yet. to remove all uncommitted changes including newly created files:

@mizanRahman
mizanRahman / Rakefile
Last active August 10, 2016 20:10
release automation
require 'date'
require 'java-properties'
def psystem(command)
puts command
# system command
end
def tag_head(version)
@mizanRahman
mizanRahman / git-release.sh
Created July 20, 2016 20:21
git release tasks
#####################
## git release
#####################
# merge feature
function fmerge() {
branch=`git rev-parse --abbrev-ref HEAD`
echo "git pull"
echo "git pull origin $1"
echo "git push origin $branch"
ai = add --interactive
amend = commit --amend
assume = update-index --assume-unchanged
assumeall = !git st -s | awk {'print $2'} | xargs git assume
assumed = !git ls-files -v | grep ^h | cut -c 3-
br = branch
bra = branch -ra
branch = branch -ra
ca = commit --amend
caa = commit -a --amend -C HEAD
@mizanRahman
mizanRahman / script.md
Last active July 11, 2016 18:08
remove all branches that are merged into current branch

To delete all local branches that are already merged into the currently checked out branch:

git branch --merged | grep -v "\*" | grep -v master | grep -v develop | xargs -n 1 git branch -d


To delete all branches on remote that are already merged:

git branch -r --merged | grep -v master | sed 's/origin\///' | xargs -n 1 git push --delete origin

task buildInfo {
def cmd = "git rev-parse --short HEAD"
def proc = cmd.execute()
ext.revision = proc.text.trim()
ext.timestamp = (int)(new Date().getTime()/1000)
}
@mizanRahman
mizanRahman / App.java
Created May 31, 2016 19:39
File Upload Sample
package com.hello.app;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.MultipartBuilder;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.ResponseBody;
import retrofit.Call;
import retrofit.GsonConverterFactory;
import retrofit.Response;
import retrofit.Retrofit;