Skip to content

Instantly share code, notes, and snippets.

@carmel
carmel / marked-katex.js
Created January 8, 2022 15:35
marked with katex
import { marked } from 'marked'
import hljs from 'highlight.js'
import katex from 'katex'
marked.setOptions({
langPrefix: 'hljs lang-',
pedantic: false,
gfm: true, // 是否启动类似Github样式的Markdown
breaks: false, // 是否支持Github换行符
tables: true, // 是否支持Github形式的表格
@carmel
carmel / hymn.py
Last active April 1, 2021 01:46
公众号【诗歌操练学习】诗歌selenium爬虫
import time
import pymysql
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
class MysqlCli():
@carmel
carmel / pool.go
Last active April 1, 2021 02:05
golang限制Goroutine的数量(Limiting Goroutines)
package pool
import (
"sync"
)
// type Work func()
type WorkPool struct {
queue chan struct{}
@carmel
carmel / dataTree.go
Last active February 10, 2021 00:52
Converts an array of items with ids and parent ids to a nested tree in a performant way
type TreeNode struct {
Id string
Name string
Pid string
Sub []*TreeNode
}
func CreateDataTree(data []TreeNode, maxDepth int) []*TreeNode {
var hash = map[string]*TreeNode{}
for i := range data {
const (
MD4 // import golang.org/x/crypto/md4
MD5 // import crypto/md5
SHA1 // import crypto/sha1
SHA224 // import crypto/sha256
SHA256 // import crypto/sha256
SHA384 // import crypto/sha512
SHA512 // import crypto/sha512
RIPEMD160 // import golang.org/x/crypto/ripemd160
SHA3_224 // import golang.org/x/crypto/sha3
@carmel
carmel / Activate Office 2019 for macOS VoL.md
Created August 5, 2020 08:29 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

@carmel
carmel / version-check.dart
Created May 9, 2019 06:10 — forked from naumanahmed19/version-check.dart
Flutter Force Update IOS and Android App Version
//Prompt users to update app if there is a new version available
//Uses url_launcher package
import 'package:url_launcher/url_launcher.dart';
const APP_STORE_URL =
'https://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftwareUpdate?id=YOUR-APP-ID&mt=8';
const PLAY_STORE_URL =
'https://play.google.com/store/apps/details?id=YOUR-APP-ID';