This file contains 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
// 在浏览器打开如下 URL,替换 id 为你自己的歌单 id | |
// https://y.qq.com/musicmac/v6/playlist/detail.html?id=3011946123 | |
// Console Script: | |
const songList = []; | |
for (const doc of document.querySelectorAll('.songlist__li')) { | |
songList.push({ | |
song: doc.querySelector('.mod_songname__name').text, | |
singer: doc.querySelector('.singer_name').text, | |
album: doc.querySelector('.album_name').text, |
This file contains 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
#!/usr/bin/env python3 | |
import re | |
# 1. define your block by a regular expression | |
RE_BLOCK = re.compile( | |
r"MariaDB \[test\]> desc (?P<name>\w+?);\n(?P<definition>.+?)\n\d+? rows in set.+?", | |
re.DOTALL | re.MULTILINE, | |
) |
This file contains 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
<style> | |
.goplay-container { margin-top: 8px; } | |
.goplay-run { margin-right: 5px; } | |
.goplay-output .stderr { color: #b50000; } | |
.goplay-output .system { color: green; } | |
</style> | |
<script type="module"> | |
import { GoPlayProxy } from "https://unpkg.com/@ggicci/goplay/dist/index.js"; | |
const goplay = new GoPlayProxy("https://goplay.ggicci.me"); |
This file contains 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
import CryptoMD5 from "crypto-js/md5"; | |
import CryptoLatin1Encoder from "crypto-js/enc-latin1"; | |
function handleUploadClick(e: React.ChangeEvent<HTMLInputElement>) { | |
if (!e.target.files) { | |
return; | |
} | |
const selectedFile = e.target.files[0]; | |
const reader = new FileReader(); |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import json | |
import smtplib | |
from argparse import ArgumentParser | |
from email.header import Header | |
from email.mime.text import MIMEText | |
from email.mime.multipart import MIMEMultipart |
This file contains 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
// 1. Define you input struct | |
type ListUsersInput struct { | |
Page int `in:"form=page"` | |
PerPage int `in:"form=per_page"` | |
IsMember bool `in:"form=is_member"` | |
} | |
// 2. Bind this input struct with an HTTP handler | |
func init() { | |
http.Handle("/users", alice.New( |
This file contains 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 ListUsers(rw http.ResponseWriter, r *http.Request) { | |
input := &ListUserInput{} | |
if err := ParseURLParams(&input); err != nil { | |
return | |
} | |
if input.IsMember // ... | |
} |
This file contains 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
type ListUsersInput struct { | |
Page int `in:"form=page"` | |
PerPage int `in:"form=per_page"` | |
IsMember bool `in:"form=is_member"` | |
} | |
input := &ListUsersInput{} |
This file contains 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
// GET /v1/users?page=1&per_page=20&is_member=true | |
func ListUsers(rw http.ResponseWriter, r *http.Request) { | |
page, err := strconv.ParseInt(r.FormValue("page"), 10, 64) | |
if err != nil { | |
// Invalid parameter: page. | |
return | |
} | |
perPage, err := strconv.ParseInt(r.FormValue("per_page"), 10, 64) | |
if err != nil { | |
// Invalid parameter: per_page. |
This file contains 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 loadScript(src) { | |
const s = document.createElement('script') | |
s.src = src | |
document.body.appendChild(s) | |
} | |
loadScript('https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.min.js') |
NewerOlder