Skip to content

Instantly share code, notes, and snippets.

View akkuman's full-sized avatar
💭
I may be slow to respond.

akkuman

💭
I may be slow to respond.
View GitHub Profile
@akkuman
akkuman / main.py
Created December 6, 2022 13:30
[匹配目标的正则]
import re
# https://regex101.com/r/GVTvvG/1
pattern = re.compile(r'^(?:(?:http|https)\:\/\/|)(?:(?:(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d))|(?:[a-zA-Z0-9\-\_]+(?:\.[a-zA-Z]+?)+?))(?:\:(0|6[0-5][0-5][0-3][0-5]|[1-5][0-9][0-9][0-9][0-9]|[1-9][0-9]{0,3}))?$')
pattern.match('http://baidu.com')
pattern.match('http://baidu.com:80')
pattern.match('http://1.1.1.1:80')
pattern.match('http://1.1.1.1')
@akkuman
akkuman / exec_powershell.py
Created November 11, 2022 01:38
[使用stdin执行powershell获取结果] #Python
import subprocess
def powershell_exec(command):
# ['powershell.exe', '-'] 也可以
process = subprocess.Popen(['powershell.exe', '-noprofile', '-noninteractive', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
out, err = process.communicate(command)
print(f'out: {out}')
print(f'err: {err}')
@akkuman
akkuman / main.go
Created November 7, 2022 03:37
[golang调用powershell脚本示例] #golang
package main
import (
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
)
@akkuman
akkuman / main.go
Last active October 24, 2022 07:38
[读取 UTF-16LE 的 csv 文件] #go
package main
import (
"encoding/csv"
"fmt"
"os"
"golang.org/x/text/encoding/unicode"
"golang.org/x/text/transform"
)
@akkuman
akkuman / main.js
Created August 11, 2022 09:05
outline导出油猴脚本
// ==UserScript==
// @name outline导出
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author you
// @match */doc/*
// @grant none
// ==/UserScript==
@akkuman
akkuman / derper.json
Last active August 9, 2022 13:19
收集的一些免费的derper节点
{
"Regions": {
"900": {
"RegionID": 900,
"RegionCode": "hz",
"RegionName": "Hangzhou",
"Nodes": [
{
"Name": "47.96.159.32",
"RegionID": 900,
@akkuman
akkuman / shell.sh
Created August 1, 2022 08:20
从所有的git commit历史中找字符串
# 这个可以搜所有提交
git rev-list --all | xargs git grep 'add_picture_to_docx'
# 这个只搜索当前分支
git log -Skeyword
@akkuman
akkuman / ramblings.md
Created July 3, 2022 12:57 — forked from slimsag/ramblings.md
Because cross-compiling binaries for Windows is easier than building natively

Because cross-compiling binaries for Windows is easier than building natively

I want Microsoft to do better, want Windows to be a decent development platform-and yet, I constantly see Microsoft playing the open source game: advertising how open-source and developer friendly they are - only to crush developers under the heel of the corporate behemoth's boot.

The people who work at Microsoft are amazing, kind, talented individuals. This is aimed at the company's leadership, who I feel has on many occassions crushed myself and other developers under. It's a plea for help.

The source of truth for the 'open source' C#, C++, Rust, and other Windows SDKs is proprietary

You probably haven't heard of it before, but if you've ever used win32 API bindings in C#, C++, Rust, or other languages, odds are they were generated from a repository called microsoft/win32metadata.

@akkuman
akkuman / bash.sh
Last active June 24, 2022 02:34
一批域名获取A记录ip
cat domains.txt | xargs dig -t A +noall +answer | awk '$4 == "A" {print($5)}' | sort | uniq
@akkuman
akkuman / cgo.md
Created April 18, 2022 09:08 — forked from zchee/cgo.md
cgo convert list

See also, http://libraryofalexandria.io/cgo/

Using Go cgo

cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.

So, Here collect materials.