This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package util | |
import ( | |
"gopkg.in/redis.v5" | |
"github.com/pborman/uuid" | |
"time" | |
) | |
const ( | |
UNLOCK_SCRIPT = "if (redis.call('get', KEYS[1]) == ARGV[1]) then \n redis.call('del', KEYS[1]) \n return 1 \n else \n return 0 \n end" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export HISTTIMEFOR="%F %T `whoami` :: " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package util | |
import ( | |
"encoding/json" | |
"errors" | |
"fmt" | |
"math/rand" | |
"time" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.leewaiho.business.common.util; | |
import org.apache.commons.codec.binary.Base64; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.math.BigInteger; | |
import java.security.*; | |
import java.security.interfaces.RSAPublicKey; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client: &http.Client{ | |
CheckRedirect: func(req *http.Request, via []*http.Request) error { | |
return http.ErrUseLastResponse | |
}, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func GetCurrentFuncInfo() (funcName string, fileName string, line int) { | |
pc, file, line, ok := runtime.Caller(1) | |
f := runtime.FuncForPC(pc) | |
if ok { | |
return f.Name(), file, line | |
} else { | |
return "", "", -1 | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rfc3339(d) { | |
function pad(n) { | |
return n < 10 ? "0" + n : n; | |
} | |
function timezoneOffset(offset) { | |
var sign; | |
if (offset === 0) { | |
return "Z"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rfc3339Date = d => { | |
const pad = n => { | |
return n < 10 ? "0" + n : n | |
} | |
const timezoneOffset = (offset) => { | |
let sign | |
if (offset === 0) { | |
return "Z" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# save as /sbin/plantuml | |
PLANTUML_JAR_FILE="/usr/lib/plantuml.jar" | |
generateUML() { | |
echo "\033[033mstart generating\033[0m" &&java -jar ${PLANTUML_JAR_FILE} $1 && echo "\033[032mgenerate success\033[0m" | |
} | |
generateUML $1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func ExampleMessage_Embed() { | |
m.Embed("/tmp/image.jpg") | |
m.SetBody("text/html", `<img src="cid:image.jpg" alt="My image" />`) | |
} |
OlderNewer