Skip to content

Instantly share code, notes, and snippets.

View dagrons's full-sized avatar
🏠
Working from home

中野三玖 dagrons

🏠
Working from home
View GitHub Profile
@dagrons
dagrons / wsl2-network.ps1
Last active October 6, 2021 06:21
wsl2网络端口映射问题 bugfix
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
@dagrons
dagrons / LXD-cheat-sheet.md
Last active January 29, 2022 06:08 — forked from berndbausch/LXD-cheat-sheet.md
lxc cheasheet

Useful LXD commands

Summarized from https://stgraber.org/2016/03/19/lxd-2-0-your-first-lxd-container-312/.

Interestingly, the LXD command line client is named.... lxc!

List available containers

lxc image list ubuntu:        # ubuntu: is officially supported image source
lxc image list images:        # images: is an unsupported source
lxc image alias list images:  # lists user-friendly names
@dagrons
dagrons / one-shot-server.service
Last active October 6, 2021 06:20 — forked from spelcaster/one-shot-server.service
Use netcat to serve a file through HTTP template
[Unit]
Description=One shot server using netcat
After=network.target
[Service]
Type=simple
PIDFile=/run/one_shot_server.pid
Restart=on-failure
Environment="PORT=4000"
Environment="FILE=/tmp/somefile.json"
@dagrons
dagrons / notes.txt
Last active October 6, 2021 06:20
分享无线网连接到有线网 tutorial
原理应该类似于NAT实现机制
1. control panel => 网络与共享中心 => 更改适配器设置 => 某网卡属性 => 分享 => 分享到(需要被分享的网卡)(这张网卡作为NAT中心使用)
2. 见到提示信息,就知道该网卡类似于NAT机制,所以需要根据提示信息去设置对应被分享的网卡的IP,网关可以缺省
3. 此时,被分享的网卡就是NAT中心了,然后将需要上网的主机和本机通过网线连接,就可以上网了
总结
@dagrons
dagrons / docker.txt
Last active June 16, 2021 03:30
docker cheatsheet
启动docker
docker run -it --name mal_backend --network mal_mal -v "$(pwd)":/app -p 5000:5000 mal_backend bash
清除docker镜像缓存
docker system prune --volumes
@dagrons
dagrons / sed-cheatsheet.md
Last active July 14, 2021 09:32 — forked from sergeyklay/sed-cheatsheet.md
Sed Cheatsheet

Sed Cheat Sheet

sed: stream editor " " vs ' ' 单引号不会执行parameter expansion,但双引号会 sed执行多个命令: sed -i "cmd1; cmd2; cmd3" input.txt $ 表示最后一行

Sed command line options

@dagrons
dagrons / nc-cheatsheet.md
Created July 10, 2021 08:14
nc/netcat cheatsheet

flags

nc [options] [host] [port] – by default this will execute a port scan
nc -l [host] [port] – initiates a listener on the given port
nc -4 – use IPv4 only
nc -6 – use IPv6
nc -u – use UDP instead of TCP
nc -k -l – continue listening after disconnection
nc -n – skip DNS lookups
nc -v – provide verbose outpu
@dagrons
dagrons / curl.md
Last active October 6, 2021 06:15 — forked from subfuzion/curl.md
curl cheatsheet

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@dagrons
dagrons / vboxmanage.md
Last active September 21, 2021 17:05
vboxmanage cheatsheet

vboxmanage cheatsheet

list vms

vboxmanage list vms 
vboxmanage list runningvms

rename vms

@dagrons
dagrons / idapython_cheatsheet.md
Last active October 6, 2021 06:18 — forked from icecr4ck/idapython_cheatsheet.md
IDAPython cheatsheet