Skip to content

Instantly share code, notes, and snippets.

View YacheLee's full-sized avatar

Ya-Che Li YacheLee

  • Doorstead
  • Taiwan
View GitHub Profile
※ CI server
@Setting tomcat for runtime deploy
1.server.xml
<Host path="/" name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="false">
2.context.xml
<Context antiResourceLocking="true">
3.tomcat-users.xml
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
@YacheLee
YacheLee / gist:378712506ad14a9389b57b1f50fb849a
Created October 19, 2016 09:50
React htmlString rendering
<div dangerouslySetInnerHTML={{ __html: htmlString}}></div>
var gcloud = require('google-cloud');
var storage = gcloud.storage;
var fs = require('fs');
module.exports = ()=> {
return new Promise((resolve, reject)=> {
var gcs = storage({
projectId: 'PROJECT_ID',
keyFilename: __dirname+'/keys.json'
});
@YacheLee
YacheLee / getMatch.js
Last active July 12, 2017 07:11
getMatchByVariables
const _ = require('lodash');
const pathToRegexp = require('path-to-regexp');
const pattern = "/activity/:_id";
const url = "/activity/123";
const match = getMatch({pattern, url});
console.log(match);
function getMatch({pattern, url}){
let keys = [];
@YacheLee
YacheLee / login_ext.js
Last active July 18, 2018 08:03
login_ext.js
const suppose = require('suppose')
, fs = require('fs');
suppose('npm', ['login', '--registry=http://npm.sencha.com', '--scope=@extjs'], {debug: fs.createWriteStream(__dirname+'/debug.txt')})
.when('Username: ' ).respond('{{YOUR_EMAIL}}\n')
.when('Password: ' ).respond('{{YOUR_PASSWORD}}\n')
.when('Email: (this IS public) ' ).respond('mymislife@gmail.com\n')
.on('error', (err)=>{
console.error(err.message);
})
@YacheLee
YacheLee / Main.java
Created August 3, 2018 16:05
String to md5 to base64
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import java.security.MessageDigest;
/**
* Created by Scott on 2018/8/4.
*/
public class Main {
public static void main(String[] args){
const axios = require('axios');
module.exports = async receivingServiceURL => {
const axiosInstance = axios.create({
baseURL: 'http://metadata.google.internal/',
timeout: 10000,
headers: {'Metadata-Flavor': 'Google'}
});
return axiosInstance.get(`computeMetadata/v1/instance/service-accounts/default/identity?audience=${receivingServiceURL}`).then(response => {
@YacheLee
YacheLee / jest_config.json
Created March 10, 2022 02:25 — forked from LauraBeatris/jest_config.json
Jest Configuration with Root Import
{
"jest": {
"testMatch": [
"**/__tests__/**/*.test.js"
],
"moduleNameMapper": {
"^~/(.*)": "<rootDir>/src/$1"
},
"setupFilesAfterEnv": [
"@testing-library/react/cleanup-after-each",