Skip to content

Instantly share code, notes, and snippets.

package main
import (
"encoding/json"
"fmt"
)
type Item struct {
Raw json.RawMessage
Values map[string][]int
@reusee
reusee / a.js
Created June 9, 2019 15:26
batch delete zhihu answers
fetch('/api/v4/members/aaaaaaa/answers').then(resp => { return resp.json() }).then(j => { for (const row of j.data) { fetch('/api/v4/answers/' + row.id, { method: 'DELETE', credentials: 'same-origin' } ).then(resp => { console.log(resp) }) } })
package main
import (
"fmt"
)
func main() {
run := func(str string, wait chan struct{}, sig chan struct{}) {
for i := 0; i < 10; i++ {
<-wait
@reusee
reusee / a.go
Created January 11, 2019 09:03
a.go
var data struct {
Status int
Content string
Data struct {
Seats map[int]struct{
NickName string
Avatar string
UID int
}
}
@reusee
reusee / malformed.go
Last active November 15, 2018 02:39
malformed.go
package main
import (
"encoding/json"
"fmt"
"strings"
)
func main() {
j := `
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="report.js"></script>
<script src="system-production.js"></script>
<script src="aff.js"></script>
</head>
@reusee
reusee / priority.go
Created October 15, 2017 10:24
priority
package main
import (
"fmt"
"sync"
"time"
)
func main() {
pt := fmt.Printf
@reusee
reusee / a.py
Created October 22, 2016 15:11
import itertools
def l():
while True:
for e in ['a', 'b', 'c', 'd']:
yield e
print(list(itertools.islice(l(), 7)))
import itertools
def l():
while True:
for e in ['a', 'b', 'c', 'd']:
yield e
print(list(itertools.islice(l(), 7)))
@reusee
reusee / foo.js
Created September 25, 2016 19:38
js
let infos = [
{
"MENU_ID": 1,
"MENU_NAME": "系统管理",
"MENU_URL": "#",
"PARENT_ID": 0,//顶级菜单
"MENU_ORDER": 1//菜单的顺序
},
{
"MENU_ID": 2,