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 / 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 / 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 / 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 / idapython_cheatsheet.md
Last active October 6, 2021 06:18 — forked from icecr4ck/idapython_cheatsheet.md
IDAPython cheatsheet
@dagrons
dagrons / VAGRANT-Cheat-Sheet.md
Last active October 6, 2021 06:17 — forked from carlessanagustin/VAGRANT-Cheat-Sheet.md
vagrant cheat sheet

Vagrant Cheat Sheet

add image

local

$ vagrant box add {title} {url}
$ vagrant init {title}
$ vagrant up
@dagrons
dagrons / proxmox_resize_pve-root
Last active February 19, 2025 11:31
Proxmox - Resize pve-root lvm root expand
# Check disk space before
df -h
# Delete local-lvm storage in gui
lvremove /dev/pve/data
lvresize -l +100%FREE /dev/pve/root
resize2fs /dev/mapper/pve-root
@dagrons
dagrons / iterm2.md
Created February 26, 2022 08:24 — forked from squarism/iterm2.md
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@dagrons
dagrons / postgres-cheatsheet.md
Created February 28, 2022 03:13 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@dagrons
dagrons / latency.markdown
Created March 10, 2022 08:28 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs