Skip to content

Instantly share code, notes, and snippets.

@netwjx
netwjx / foo.js
Last active August 18, 2023 16:57
discord batch delete
// 断点代码特征:W.rU)(t.id
window.ddd = W.rU // 断点后抽取函数
// 断点代码特征:me.WO)(O,
window.uuu = me.WO // 断点后抽取函数
@netwjx
netwjx / batch-command.md
Created September 8, 2022 06:46
批量处理文件
➜ ls | xargs -i echo mv {} {} | sed 's/.txt/.md/2g'
mv 0001.txt 0001.md
mv 0002.txt 0002.md
mv 0003.txt 0003.md
mv 0004.txt 0004.md
mv 0005.txt 0005.md
@netwjx
netwjx / mtime2douban.user.js
Last active May 25, 2021 13:57
mtime2douban
// ==UserScript==
// @name mtime2douban
// @namespace mtime2douban
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://my.mtime.com/*/seen
// @match http://my.mtime.com/*/wantSee
// @match https://search.douban.com/movie/subject_search*
// @match https://movie.douban.com/subject/*
@netwjx
netwjx / key-mappings.vim
Created August 21, 2019 02:46
Vimium Options Custom key mappings
# Insert your preferred key mappings here.
# 帮助, 默认键容易和网页现有快捷键冲突
map :? showHelp
unmap ?
# m键和 Confluence 评论快捷键冲突, mark + goto mark几乎用不到
unmap m
unmap `
@netwjx
netwjx / route.coffee
Created April 28, 2015 08:13
路由更新
routes =
'192.168.0.0': '255.255.0.0'
Future = require 'fibers/future'
child_process = require 'child_process'
iconv = require 'iconv-lite'
Future.task ->
stdout = exec 'route print'
fs = require 'fs'
newname = (f, date, time)->
c = fs.readFileSync f,
encoding: 'utf-8'
[skip, title] = c.match /^Title: ([^\r\n]+)$/m
content = c.replace /^Date: .*$/m, ($0)->
"
# coding: utf-8
from __future__ import with_statement
import os, re
reName1 = re.compile(r'^\d+-\d+-\d+_[^\.]+\.markdown$')
reName1_1 = re.compile(r'^\d+-\d+-\d+_[^\.]+\.md$')
reName2 = re.compile(r'^\d+-\d+-\d+-[^\.]+\.markdown$')
reDate = re.compile(r'^date: ([\d\-]+) (\d+):(\d+)\n$', re.I)
@netwjx
netwjx / README.md
Last active October 27, 2023 18:13
使用ping批量测试服务器速度

支持一个输入参数: ip地址文件列表

所有不是ip地址的行都会忽略,所以可以这样

1.2.3.4

my comment text

每个ip会ping5次,结果以平均响应时间从小到大排序,最快的在开头.

# coding: utf-8
from __future__ import with_statement
import os, re
reName1 = re.compile(r'^\d+-\d+-\d+_[^\.]+\.markdown$')
reName1_1 = re.compile(r'^\d+-\d+-\d+_[^\.]+\.md$')
reName2 = re.compile(r'^\d+-\d+-\d+-[^\.]+\.markdown$')
reDate = re.compile(r'^date: ([\d\-]+) (\d+):(\d+)\n$', re.I)
@netwjx
netwjx / scrollFollow.coffee
Created January 23, 2014 10:06
滚动跟踪,简单的实现,range控制滚动的上下限(和range指定的元素上下边界对齐),支持超出一屏高度的调整
scrollFollow = (ele, opts)=>
ele = $ ele
range = $ opts.range
n = 0
lastTop = $(window).scrollTop() - 1
scrolling = ->
top = $(window).scrollTop()
viewHeight = $(window).height()
eleHeight = origEleHeight = ele.height()
eleHeight = viewHeight if eleHeight < viewHeight