Skip to content

Instantly share code, notes, and snippets.

View Kurukshetran's full-sized avatar
🎯
Focusing

Kurukshetran Kurukshetran

🎯
Focusing
View GitHub Profile
http://cronus.allowed.org works for me, 2018.1.6
@Kurukshetran
Kurukshetran / hgupdate.sh
Created October 11, 2018 08:58 — forked from ziadoz/hgupdate.sh
Bash Mercurial Update Script
#!/bin/bash
# Usage: ./hgupdate.sh /path/to/repositories
# Trap Ctrl + C command and exit the script.
trap 'exit 1' 2
# Strip trailing slashes from argument and test it's a directory.
TARGET=${1%/}
if [[ ! -d $TARGET ]]; then
echo "Please pass in a directory path."
@Kurukshetran
Kurukshetran / migrate_hg_to_git.sh
Created October 11, 2018 08:57 — forked from marcells/migrate_hg_to_git.sh
This small bash script migrates all the given bitbucket mercurial repositories to git (the remote repositories are created automatically). Prerequisites: hg, http://hg-git.github.io and curl
#!/bin/bash
# General settings
username="bitbucket username"
password="bitbucket password"
tmp_local_repo_path=/tmp/bb_migration
# Define repository mappings: repos["hg_repo_name"]="new_git_repo_name"
declare -A repos
#repos["hg_repo_1"]="new_git_repo_1"
@Kurukshetran
Kurukshetran / gist:c63d7828c270390955eae66f0f6500e1
Created October 11, 2018 08:44 — forked from serkan-ozal/gist:b6a9701801279736e5ec
A Hacky Way to Clean All Thread Local Variables of Current Thread
void cleanThreadLocalsOfCurrentThread() {
try {
// Get a reference to the thread locals table of the current thread
Thread thread = Thread.currentThread();
Field threadLocalsField = Thread.class.getDeclaredField("threadLocals");
threadLocalsField.setAccessible(true);
Object threadLocalTable = threadLocalsField.get(thread);
// Get a reference to the array holding the thread local variables inside the
// ThreadLocalMap of the current thread
private void cleanUpJythonMess() {
try {
//Jython stores a reference to the system state on a thread local, when the system state is closed
//Jython does not remove the TL so... hey presto a leak
//The only way we can remove it is to use reflection to manually remove the tl entry
//Nice huh!?
//See https://github.com/vert-x/vert.x/issues/417 for more info
//Also http://bugs.jython.org/issue1327
@Kurukshetran
Kurukshetran / continuous-deploy.py
Created October 1, 2018 13:18 — forked from tildedave/continuous-deploy.py
Automated WAR Deployer (in Python)
#!/bin/python2.6
import os
import sys
import shutil
import subprocess
import time
from optparse import OptionParser
JAVA_HOME="/usr/lib/jvm/java-1.6.0-openjdk/"
@Kurukshetran
Kurukshetran / bash
Created October 1, 2018 10:49 — forked from jonashackt/bash
Remote debugging Spring Boot
### java -jar
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8001,suspend=y -jar target/cxf-boot-simple-0.0.1-SNAPSHOT.jar
### Maven
Debug Spring Boot app with Maven:
mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8001"
@Kurukshetran
Kurukshetran / logstash-grok-spring-boot.conf
Created September 27, 2018 11:39 — forked from daniellavoie/logstash-grok-spring-boot.conf
Logstash grok filter for Logback Logger used by Spring Boot applications
input {
file {
path => /tmp/application.log
codec => multiline {
pattern => "^(%{TIMESTAMP_ISO8601})"
negate => true
what => "previous"
}
}
}
@Kurukshetran
Kurukshetran / logstash.conf
Created September 27, 2018 11:38 — forked from mallim/logstash.conf
Logstash config for Spring Boot's default logging
input {
file {
type => "java"
tags => [ "fornax-data-share-eureka" ]
# Logstash insists on absolute paths...
path => "D:/fornax-data-share-runtime/eureka/fornax-data-share-eureka.log"
codec => multiline {
pattern => "^%{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{TIME}.*"
negate => "true"
what => "previous"
@Kurukshetran
Kurukshetran / App.java
Created August 20, 2018 11:16 — forked from thomasdarimont/App.java
Secure REST API Example with Spring Security, Spring Session, Spring Boot
package demo;
import java.io.Serializable;
import java.security.Principal;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;