Skip to content

Instantly share code, notes, and snippets.

View vamdt's full-sized avatar

vamdt vamdt

  • Foggy Beijing
View GitHub Profile
@vamdt
vamdt / idea_bash.bat
Created May 8, 2018 08:04
idea terminal bash shell path
@echo off
SET bashbin="f:\tools\cmder\vendor\git-for-windows\bin"
SET currentpath=%cd%
REM replace \ to /
SET unixpath=%currentpath:\=/%
REM replace : to empty
SET unixpath=%unixpath::=%
REM add / at begnning
SET unixpath=/%unixpath%
@vamdt
vamdt / ForwardService.java
Last active April 20, 2018 17:20
SpringMVC forward request
package com.vamdt.fox.fox.service;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
@vamdt
vamdt / ssh_connection_test.sh
Last active August 16, 2017 03:22
ssh_connection_test
for i in $(cat ip.txt)
do
ssh -q -p 16322 -o "BatchMode=yes" -o "ConnectTimeout=3" "$i" "echo 2>&1" && echo "$i OK" || echo "$i NOK"
done
@vamdt
vamdt / KafkaTopicUtil.java
Last active August 22, 2018 05:39
Dynamic create kafka topic
package com.hello.world;
import joptsimple.internal.Strings;
import kafka.admin.AdminUtils;
import kafka.admin.RackAwareMode;
import kafka.utils.ZKStringSerializer$;
import kafka.utils.ZkUtils;
import org.I0Itec.zkclient.ZkClient;
import org.I0Itec.zkclient.ZkConnection;
@vamdt
vamdt / ajax_window_open.js
Created August 4, 2017 03:53
ajax async set false to make window open works
$.ajax({
url: "/",
async: false,
dataType: "json",
success: function() {
window.open("http://google.com", "_blank");
}
});
@vamdt
vamdt / high_cpu_threads.sh
Created May 11, 2017 07:17
Print high cpu thread jstack message
#!/bin/bash
usage() {
echo "Usage: $0 -p <pid> [-n <thread number>]"
}
# args check
while getopts ":p:n:" arg; do
case "$arg" in
p)
@vamdt
vamdt / .ideavimrc
Last active December 26, 2022 11:53
ideavim config
set hls
set ignorecase smartcase
set incsearch
set showmode
" minimum nr. of lines above and below cursor
set so=5
" enable vim-surround plugin
set surround
@vamdt
vamdt / bugn_Config.ini
Created September 14, 2016 14:58
bugn config
; bug.n - tiling window management
; @version 9.0.0
Monitor_#1_aView_#2=3
View_#1_#1_layout_#1=2
View_#1_#1_layoutMFact=0.250000
Config_fontName=微软雅黑
Config_fontSize=10
@vamdt
vamdt / proxy.conf
Created August 3, 2016 08:05
nginx proxy cache configuration
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding 'gzip';
client_max_body_size 100m;
client_body_buffer_size 256k;
proxy_connect_timeout 60;
proxy_send_timeout 60;
@vamdt
vamdt / UTF8MB4ConnectionCustomizer.java
Created June 18, 2016 08:52
UTF8MB4ConnectionCustomizer
package com.vamdt.api.common
import com.mchange.v2.c3p0.AbstractConnectionCustomizer;
import java.sql.Connection;
import java.sql.Statement;
public class UTF8MB4ConnectionCustomizer extends AbstractConnectionCustomizer {
@Override
public void onAcquire(Connection c, String parentDataSourceIdentityToken) throws Exception {