Category Archives: Programming

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/127.0.0.1/7777
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.

AWS IAM Roles

As I have been developing and testing on Amazon Web Services (AWS) hosting I have made much use of the Identity and Access Management (IAM) feature. In particular, I have found the IAM Roles to be extremely helpful. I can assign a role to a specific instance or even a launch group of instances. When those instances are launched they have all the permissions of the role that I have specified for them. This means that if an instance needs to access files that are on S3, I just add that permission to the role and the instance is able to access S3 files. This is extremely useful for system admin scripts as well as other programming tasks.
Continue reading AWS IAM Roles

Developer Alone Time

There is an aspect of programming that is essential to productivity. It is the time it takes a developer to get into their “zone” where they are most productive (much, much more productive than at other times). There are several articles in particular that expound upon this principle.

If a developer or designer has their headphones on and seems to be “in the zone“, try to refrain from interrupting them unless deemed absolutely necessary. Try to email.

Acceptable Forms of “Interrupting”

These forms of communication are “asynchronous”. That means that these forms of communication fit into the flow of thought much more easily. The developer or designer can retain their focus on their computer the whole time.

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
– http://nvie.com/posts/a-successful-git-branching-model/
– http://progit.org/book/
– git reset: http://progit.org/2011/07/11/reset.html

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!

Update:
More helpful vim links.