Skip to content

Instantly share code, notes, and snippets.

View strongant's full-sized avatar

strongant strongant

View GitHub Profile
@strongant
strongant / SpringBootJUnitTest.md
Last active May 28, 2018 15:36
SpringBoot单元测试demo

对SpringBoot项目进行单元测试

  1. http://start.spring.io/ 选择要测试的SpringBoot版本,这里选择“1.5.4.RELEASE”。
  2. 选择需要添加的模块依赖:选择spring-boot-starter-actuator和spring-boot-starter-test
  3. 点击生成项目按钮
  4. 解压项目压缩包
  5. 导入IDEA
  6. 在src/java 目录下新建具体的测试Controller,如创建HelloWorldController.java 测试Controller:
package com.example.springbootjunittest.controller;
## Obtain Token and Invoke Service
@diegopacheco
diegopacheco / java8-centos-amazon-linux.md
Last active October 25, 2022 18:17
How to Install Java 8 in CentOS / Amazon Linux?
# Remove java 7
sudo yum remove -y java

# Install basic packages
sudo yum install -y git

# Download and install java 8
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz"
tar -xzvf jdk-8u131-linux-x64.tar.gz
@jomoespe
jomoespe / LambdaExceptionUtil.java
Last active December 22, 2023 12:36
Utility class to handle checked exceptions from
/**
* Utility class to handle checked exceptions in lambdas.
* <p>
* From <a href="http://stackoverflow.com/questions/27644361/how-can-i-throw-checked-exceptions-from-inside-java-8-streams">How can I throw CHECKED exceptions from inside Java 8 streams?</a>.
* This class helps to handle checked exceptions with lambdas. Example, with Class.forName method, which throws checked exceptions:
* </p>
* <pre>
* Stream.of("java.lang.Object", "java.lang.Integer", "java.lang.String")
* .map(rethrowFunction(Class::forName))
* .collect(Collectors.toList());
@atrolla
atrolla / howto.md
Last active October 31, 2022 15:52
Deploy multiple Spring boot app on a single tomcat with different configuration for each app
@yzyzsun
yzyzsun / shadowsocks-libev.sh
Last active August 16, 2023 05:38
shadowsocks-libev server setup script on CentOS 7
cd /etc/yum.repos.d
curl -O https://copr.fedorainfracloud.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo
yum -y install shadowsocks-libev
setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/ss-server
cat > /etc/shadowsocks-libev/config.json << 'EOF'
{
"server": "0.0.0.0",
"server_port": 443,
"password": "p@$$w0rd",
"method": "aes-128-gcm"
@rherrmann
rherrmann / CloneLearningTest.java
Last active July 21, 2023 19:15
'Learning Tests' that uses the JGit API to clone existing repositories: http://www.codeaffine.com/2015/11/30/jgit-clone-repository/
package com.codeaffine.jgit.example;
import static java.util.Collections.singleton;
import static org.eclipse.jgit.api.ListBranchCommand.ListMode.ALL;
import static org.eclipse.jgit.transport.RemoteConfig.getAllRemoteConfigs;
import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import java.util.List;
@tychobrailleur
tychobrailleur / 01 Bootstrap.md
Last active January 16, 2018 10:06
Grails Notes

Bootstrap Scripts

## Grails script, startGrails Grails main class in startGrails is org.codehaus.groovy.grails.cli.support.GrailsStarter that sets up config to execute org.codehaus.groovy.grails.cli.GrailsScriptRunner to run Groovy scripts. Executes the Groovy script, in interactive mode if no script invoked. ~/.grails/.aliases may contain command aliases.

Startup

RunApp.groovy -> _GrailsRun.groovy instantiates GrailsProjectRunner (org.codehaus.groovy.grails.project.container.GrailsProjectRunner in grails-project-api). Also calls _GrailsWar that calls _GrailsClean and _GrailsPackage.

_GrailsPackage.groovy packageApp calls:

  • compile from _GrailsCompile.groovy that compiles Groovy and Java sources (“Packaging Grails application”).
@tpai
tpai / instructions.md
Last active December 19, 2024 06:55
use both Tor and Privoxy on Mac OS

1. install

brew install tor
brew install privoxy

2. copy and modify config file

@subchen
subchen / jetbrick.print.js
Created November 3, 2014 10:30
JavaScript 实现打印功能(只打印网页中的一部分)
(function(window, $) {
/**
* 实现打印功能(只打印网页中的一部分)
*
* Usage:
* <button jw-click-print="#printContext">Print</button>
*/
var print = function($dom) {
$("iframe.js-print").remove();