Skip to content

Instantly share code, notes, and snippets.

View iamspark1e's full-sized avatar
🎶
The Real Folk Blues

Wenbo iamspark1e

🎶
The Real Folk Blues
View GitHub Profile
package main
import (
"bytes"
"io"
"log"
"os"
"os/exec"
"strings"
import (
"fmt"
"net/http"
"os"
"strings"
"github.com/gin-gonic/gin"
"caddy-http-tls-provider/bootstrap"
"caddy-http-tls-provider/utils"
let status = false;
let iframeReq = () => {
return new Promise((resolve, reject) => {
let timeout = 10;
let counter = 0;
let timer = setInterval(() => {
if(!status) {
if(counter < timeout) {
counter++;
} else {
@iamspark1e
iamspark1e / pure-css-tabs.html
Created June 20, 2023 06:50
Pure CSS Tabs, forked from CodePen(https://codepen.io/markcaron/pen/MvGRYV), just in case lost.
<style>
/*
CSS for the main interaction
*/
.tabset > input[type="radio"] {
position: absolute;
left: -200vw;
}
.tabset .tab-panel {
## Office E5 mail
relayhost = [smtp.office365.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sender_dependent_authentication = yes
smtp_generic_maps = hash:/etc/postfix/generic
# STARTTLS in my case, this can solve SSL handshake error.
smtp_tls_security_level = may
# If your network cannot access IPv6.
import (
"crypto/tls"
"encoding/base64"
"fmt"
"log"
"net"
"net/smtp"
"strings"
)
@iamspark1e
iamspark1e / worker-pool.go
Created October 20, 2022 09:00 — forked from harlow/worker-pool.go
Worker pool to control concurrency and collect results
package main
import (
"fmt"
"sync"
"time"
)
const concurrency = 3
package main
import (
"fmt"
"runtime"
"time"
)
func main() {
ticker := time.NewTicker(200 * time.Millisecond)
@iamspark1e
iamspark1e / check-is-safe-parent-domain.js
Created April 8, 2022 03:18
Check any url is in safe parent domain without URL class. 检查任意URL是否在它的父级域下,不使用URL。
function isSafeParentDomain(url, safeDomains) {
try {
// Using polyfill for String.prototype.endsWith
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(search, this_len) {
if (this_len === undefined || this_len > this.length) {
this_len = this.length;
}
return this.substring(this_len - search.length, this_len) === search;
};
var threedTheme = document.createElement('style')
threedTheme.innerHTML = "* {text-overflow: clip;letter-spacing: 3px;text-shadow: -3px 0 1px cyan, 3px 0 1px red;}"
document.head.append(threedTheme)