Skip to content

Instantly share code, notes, and snippets.

View alswl's full-sized avatar

Jingchao Di alswl

View GitHub Profile
@alswl
alswl / basic-auth.xml
Created December 25, 2018 13:33
spring basic auth for HTTP bean configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
<constructor-arg ref="httpClientFactory" />
<property name="messageConverters">
DROP TABLE IF EXISTS dept;
DROP TABLE IF EXISTS salgrade;
DROP TABLE IF EXISTS emp;
CREATE TABLE salgrade(
grade int(4) not null primary key,
losal decimal(10,2),
hisal decimal(10,2));
CREATE TABLE dept(
@alswl
alswl / arch-docker-fox.md
Created September 3, 2018 11:01
arch-docker-fox.md

Build Foxone in Docker

Docker start in macOS:

docker-machine start default
eval $(docker-machine env default)
@alswl
alswl / .gitignore
Last active July 3, 2018 08:06
gitignore
We couldn’t find that file to show.
digraph G {
compound = true;
fontsize = 14;
margin = "0,0";
ranksep = 0.2;
nodesep = 0.5;
penwidth = 0.5;
colorscheme = spectral7;
XML_URL=`c Casks/cctalk.rb G appcast | awk -F "'" '{print $2}'`
XML_SHA256=`curl -s $XML_URL | gsha256sum`
PUBDATE=`curl -s $XML_URL | xmlstarlet sel -t -v '//pubDate' | awk '{print $1}'`
VERSION=`curl -s $XML_URL | xmlstarlet sel -t -v '//title' | awk '{print $2}'`
BUILD=`curl -s $XML_URL | xmlstarlet sel -t -v '//sparkle:version'`
VERSION_ALL="$VERSION-$BUILD,$PUBDATE"
sed -i "s/version .*/version '$VERSION_ALL'/" Casks/cctalk.rb
sed -i "s/sha256 .*/sha256 ''/" Casks/cctalk.rb
#!/bin/bash
cd `dirname $0`
BIN_DIR=`pwd`
cd ..
DEPLOY_DIR=`pwd`
CONF_DIR=$DEPLOY_DIR/conf
SERVER_NAME=`sed '/dubbo.application.name/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
LOGS_FILE=`sed '/dubbo.log4j.file/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
@alswl
alswl / foo.py
Last active November 22, 2017 10:07
大吉大利,晚上吃鸡
# echo "V2loYWx1bm9mdW5jaWhtISBTaW8gYWluIGNuISBXZnVjZyBzaW9sIGpsY3R5IHFjbmIgc2lvbCB1ZmFpbGNuYmc6IDU5NTkyMjY4LiBCaWp5IGNuIGNtIGhpbiB4aWh5IHZzIGJ1aHguIE5idW4gY20gcWJzIHF5IGJ1cHkgd2lnam9ueWxtIHVoeCBVQy4gSGlxIG9teSBuYnkgZXlzIG5pIHV3d3ltbSBCQ0ZGIFVDIG15bHBjd3k6IHh5dnV5eTR1enp2eXV2dTkwOXUxODQwNjY5ODF4NTV1Lg==" | base64 -D
raw = 'Wihalunofuncihm! Sio ain cn! Wfucg siol jlcty qcnb siol ufailcnbg: 59592268. Bijy cn cm hin xihy vs buhx. Nbun cm qbs qy bupy wigjonylm uhx UC. Hiq omy nby eys ni uwwymm BCFF UC mylpcwy: xyvuyy4uzzvyuvu909u184066981x55u.'
for i in raw:
if i >= 'a' and i <= 'z':
print(chr((ord(i) + 6 - ord('a')) % 26 + ord('a')), end='')
elif i >= 'A' and i <= 'Z':
print(chr((ord(i) + 6 - ord('A')) % 26 + ord('A')), end='')
else:
# coding=utf-8
from __future__ import unicode_literals, absolute_import, print_function
import logging
from io import BytesIO
import base64
import requests
from PIL import Image
@alswl
alswl / release-to-git-release-binary-branch.sh
Last active August 4, 2017 08:35
sbt release to release-binary branch
#!/bin/bash
set -x
sbt assembly
GIT_HASH=`git rev-parse --short HEAD`
BRANCH=release-binary-`date +%y%m%d.%H%M`-$GIT_HASH
TAG=v-`date +%y%m%d.%H%M`
git tag $TAG
git push origin $TAG