Category Archives: Unix/Linux

Network Redirection: UDP/TCP to a File

I just learned a cool bash trick. Redirecting network traffic to a file.

Open two bash terminal windows.

t1$ nc -l 7777 >> TESTFILE
t2$ exec 3<>/dev/tcp/
t2$ echo 'Hello World!' >&3
t1$ cat TESTFILE

Your TESTFILE now has Hello World! in it.

There are quite a few ways to do this and similar operations, easy found on the Googles.

*Note: Other shells may work, I used bash. Your shell may or may not have redirection capabilities built into it.

Git Notes

I have recently taken the plunge into learning Git. These are my notes thus far. I know there are plenty of git write-ups out there on the web. I started this one mostly for myself as a quick cheat sheet. I figure it may be useful to someone so I am sharing it.

My typical git workflow

– git init (or clone)
– work on files on main branch
– git branch [newbranchname] (create a new branch for a new feature)
– git checkout branch (switch to that new branch)
– git merge [newbranchname] (merge new feature into main branch)
– git add . (or git add path/to/file(s))
– git commit (leave good notes)
– git pull [remote] [branch] (to sync with other devs)
– git push [remote] [branch] (send my local commits to other devs or repo server)

Some descriptions of other git commands

git init (initializes a directory as a new Git repository)
git clone [url] (copies an existing Git repository)
git status
git remote (list local "remote" aliases)
git remote add/rm [url] (creates a new alias)
git add (add changes; those could be in files or directory structure)
git add -u (adds unstaged changes including deletes not done with git rm)
git add -p (add changes per chunk in a file!)
gif diff (--cached for staged changes)
git commit (records a snapshot of the staging area)
git commit -m (specify a commit message on the command line)
git commit -a (skip the add step and do it automatically -a will not add new files)
git rm (delete a file, can be used to actually delete the file or after the fact to inform git of the action)
git rm --cached
(aka un-add/un-track)
git reset
(unstage changes that you have staged, opposite of git add)
git checkout --
..." to discard changes in working directory (???)
git update-index --assume-unchanged (ignore uncommitted changes in a file that is already tracked)
git pull/push (eg git push memoryties master)

My main source of information so far has been Git Reference.

Other resources
– git reset:

My Vim Cheatsheet

A while ago I read some Vim tutorials that were written by Joe ‘Zonker’ Brockmeier and found them to be an excellent source of quick tips for a cheat sheet. So I set out to create a cheat sheet I could hang near my computer. I finally got around to finishing it. So I am making it publicly available.

My Vim Cheatsheet
My Vim Cheatsheet

Since I finished it I have found some other tidbits and had some other ideas for enhancing the sheet further. If I ever get around to it, I will update the link with the newer version.

Enjoy! I hope it is as useful for you as it is for me.

Long live Vim!

More helpful vim links.