Skip to content

Instantly share code, notes, and snippets.

View leolin310148's full-sized avatar

Leo Lin leolin310148

View GitHub Profile
@leolin310148
leolin310148 / spring_security_oauth2_mysql.schema
Last active August 25, 2020 02:29
Spring Security OAuth2 MySQL Schema
create table oauth_client_details (
client_id VARCHAR(255) PRIMARY KEY,
resource_ids VARCHAR(255),
client_secret VARCHAR(255),
scope VARCHAR(255),
authorized_grant_types VARCHAR(255),
web_server_redirect_uri VARCHAR(255),
authorities VARCHAR(255),
access_token_validity INTEGER,
refresh_token_validity INTEGER,
@leolin310148
leolin310148 / ParseJsonToXml.groovy
Created June 14, 2015 09:49
Parse json to xml using groovy
import groovy.json.JsonSlurper
import groovy.xml.MarkupBuilder
def jsonString = "{" +
" \"result\": [" +
" {" +
" \"Name\": \"John\"," +
" \"Department\": \"001\"" +
" }," +
" {" +
StockPrices = new Mongo.Collection("StockPrices")
if (Meteor.isClient) {
Template.body.helpers({
stockPrices: function () {
return StockPrices.find({}, {sort: {tlong: -1}});
}
});
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id="vue">
@leolin310148
leolin310148 / solve.md
Last active November 22, 2019 12:46
solve "error initializing graphdriver: loopback attach failed" for docker-in-docker

Create loopback.sh in tmp

#!/bin/bash
ensure_loop(){
  num="$1"
  dev="/dev/loop$num"
  if test -b "$dev"; then
    echo "$dev is a usable loop device."
 return 0
statsd:
image: hopsoft/graphite-statsd
ports:
- 8080:80
- 2003-2004:2003-2004
- 2023-2024:2023-2024
- 8125:8125/udp
- 8126:8126
static {
HttpsURLConnection.setDefaultHostnameVerifier((s, sslSession) -> true);
TrustManager[] trustManagers = new TrustManager[]{
new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
find . -name '*.txt' | xargs wc -l
@leolin310148
leolin310148 / gist:f1770ea02592e0111470b62ad172ccd0
Created March 31, 2020 04:40
AWS RDS reset master password
aws rds modify-db-instance --db-instance-identifier ${db-identifier} --master-user-password ${pwd}
@leolin310148
leolin310148 / foo.kt
Created March 22, 2023 07:22
kotlin operation function return self can invoke forever
enum class Foo {
HELLO,
WORLD,
//
;
var i = 0
}