Skip to content

Instantly share code, notes, and snippets.

@BigW72
BigW72 / rsync-trailing-slash.md
Created December 10, 2023 15:01
rsync trailing slash

From https://unix.stackexchange.com/questions/402555/why-add-a-trailing-slash-after-an-rsync-destination

It does make a difference when the source is a file and the destination directory does not exist. For instance take a file called file as source:

$ rsync file dest/ will create a copy of file inside a directory dest, whereas

$ rsync file dest will make a copy of the file file called dest

To add (from the comments); if a directory dest already exists, a copy file will be created in dest in both cases above.

@BigW72
BigW72 / gist:1575ff7254049f0bee87f2bf545e7090
Created November 16, 2023 23:47
CSV to JSON Python one liner
# https://stackoverflow.com/questions/44780761/converting-csv-to-json-in-bash
cat my.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))'
@BigW72
BigW72 / tmux-start-up.md
Last active January 20, 2020 16:03
Start tmux by attaching to an existing session if it exists or creating a new one if one doesn't exist
@BigW72
BigW72 / port-listener.sh
Created November 11, 2018 22:56
What is listening on port x?
sudo netstat -tulpn | grep ":53 "
pip install --upgrade --upgrade-strategy only-if-needed somepackage
@BigW72
BigW72 / tramp-remote-sudo
Last active August 6, 2018 11:59
Tramp format: edit files as root on remote host (Emacs)
/ssh:<remote-user>@<remote-host>|sudo:root@<remote-host>:/etc
@BigW72
BigW72 / getmacmodel.sh
Created March 25, 2018 21:00
Get Mac model number
ioreg -l | awk '/product-name/ { split($0, line, "\""); printf("%s\n", line[4]); }'
@BigW72
BigW72 / onename.txt
Created June 8, 2016 23:38
onename.com
Verifying that +wessel is my blockchain ID. https://onename.com/wessel

Keybase proof

I hereby claim:

  • I am wdpreez1 on github.
  • I am wdp (https://keybase.io/wdp) on keybase.
  • I have a public key whose fingerprint is 49E1 75A3 6E4E 0E94 326F F0BA 5B0F 17D9 6DA2 CDE6

To claim this, I am signing this object:

@BigW72
BigW72 / remote-tcpdump
Last active August 29, 2015 14:10
Remote packet capture using tcpdump
> `ssh root@dsl-router "tcpdump -s 0 -U -n -w - -i br0 not port 22" > /tmp/fifo/cap_fw`
`-s 0` means captures 0 bytes of data of each packet (i.e. just the header)
`-n` means don't look up the addresses
`-U` means write the descriptions immediately, not when closing the file
`-w -` means write to stdout