This site has been archived and will no longer be updated.
You can find my new profile at neilpahl.com. My new blog is at 808.ninja.
Wed, 28 Aug 2013:
Since my last post, I've been trying different programming languages, and different vim modules & settings to accomodate those. I currently have a generic vim setup, which is getting mixed up as I switch between different 'modes' of development.
Coming soon, I'll create different vim profiles so that I can easily switch between the different 'mode' I'm in.
For each mode, I'll make a new git repository, define custom code snippets for autocompletion and pick focused modules.
I am going to need a way to easily switch between these profiles on my computer as well.
Wed, 28 Aug 2013:
Good system admins are able easily look through directories and files for specific targets or patterns and then either aggregate data for easy viewing or perform tasks on files.
If its something done regularly, then one would usually design a script which can handle the task.
However, if its a one off task then the best case scenario is having access to some ninja skills and tools which can make the job less tedious and more efficient. Otherwise, you're stuck doing things manually.
Throughout this log, I will pick out entries from www.commandlinefu.com and break down the building blocks of that elegant (intimidating to some) command.
Tue, 24 Jul 2012:
Alot of the time I need to join via VPN just so that I can reach the web resources which are only offered on the remote LAN. In this case, seting up a complete VPN infrastructure can be overkill and more efffort than I would like.
So, instead I create an ssh tunnel and route my web traffic to the remote LAN. With just a simple ssh tunnel, and a little configuration to Firefox, I no longer have to add to the complexity of my server on that network. I believe that a simpler setup can reduce vulnerabilities down the line as there is less software you need to keep applying security patches for.
First I need to bind a port to the ssh tunnel. I'm going to use port 1080 since its the one used for the SOCKS proxy in firefox that allows us to use the remote dns. Other uses may require a different port to be bound.
In Linux, just add the -D option to your regular ssh command:
ssh -D 1080 username@remoteiporaddress.com -p 22
the -D is to bind port 1080. the -p is not needed as port 22 is default (my server is behind a firewall so I had to previously setup a reverse tunnel through a relaying agent and therefore usually I use a port other than 22).
In Windows,
I use PuTTy. Enter the usual (Domain name, Username, port) to access the remote server via ssh. To create the tunnel for port 1080, add the configurations to:
Connection > SSH > Tunnels
Under "Add new forwarded port:" put:
source port: 1080
and select the "Dynamic" radio box.
click "Add"
Once the ssh connection is made, the tunnel will be there too. Now, the only trick to this is seting up firefox to use SOCKs proxy with remote dns...
I'm using firefox 14, inthe url bar enter About:config, and click teh button saying you'll be careful (because you will). Now, search for something along the lines of socks_remote_dns and double click the result to make it true.
Now, go to Edit > Preferences
Advanced > Network > Connection > Settings
select the "manual proxy configuration" radio button and fill in:
SOCKS Host: locahost Port: 1080
And then, you should be able to find web guis which are onthe remote network. I find it particularly usefull for changing the router settings of a router that uses a web interface. for example if I go to their address like "192.168.1.1"
Also, in order to not allways mess with my firefox settings, I use a portable version of firefox which I can stick on a thumb drive. That combined with a portable version of putty can give me the ability to acces that network from anywhere.
Mon, 02 Jul 2012:
I modified the update bundles script which I use to manage my vim plugins (along with Tim Pope's pathogen) so that it can download plugins which are held in hg repositories.
I needed to do this in order to have it get the autcomplpop plugin which will allow popup autocompletion while coding. to use this plugin I had to also download the L9 Library which is written by the same author and held in a hg repo on bitbucket. my vim configs are in my git repo:
Fri, 29 Jun 2012:
A great git branching model was proposed on nvie.com and can be found here:
http://nvie.com/posts/a-successful-git-branching-model/
I highly recommend anyone to first go and read it since it is very elegantly explained, along with pleasant diagrams. Here, I'm just going to highlight a few of the code snippets for my own reference.
- There are 2 main branches... develop and master.
- Master is assumed to be production ready, develop is branched from master and merged back to master when it is stable enough.
- Master is tagged with a version each time it is updated.
Using my private repo that I set up in my last entry, I'll switch to the master branch(probably already starts there but I'll be explicit), then tag my first version of master
git checkout origin master git tag -a '0.01' -m 'first version 0.01'
next, I would create and checkout a dev branch
git checkout -b develop master
which is just short for
git branch develop master git checkout develop
so, if you don't need to checkout develop, you can jsut create it with 'git branch develop master'
push your local development branch to remote:
git push origin develop
-create and checkout a feature branch off of the develop branch
git checkout -b newFeature develop
-do work on the feature branch.. then update the feature branch
git add . git commit -m 'added blah to my feature'
- merge my feature branch with develop using no fast-forward, then delete the newFeature branch
git checkout develop git merge --no-ff newFeature
-delete teh feature branch
git branch -d newFeature
-push back to develop
git push origin develop
git checkout -b release-0.02 develop
- test the release branch. creating a new release branch is good practice so that the develop branch can still be worked on while testing is going on release. I'd imagine that on a smaller project one can just merge the develop branch into master
- merge release into production (master)
git checkout master git merge --no-ff release-0.02 git tag -a 'version 0.02'
- merge back into develop
git checkout develop git merge --no-ff master
-delete release branch
git branch -d release-0.02
Just create a branch off of develop, release, or master, and merge it back after fixing the bug.
- view remote names with locations using
git remote -v
- view all local and remote branches with
git branch -a
- view remote branches with
git branch -r
+ add 'v' for some more info.. ie:
git branch -rv
- add remote branches:
git push <remote-name> <branch-name>
- delete remote branches:
git branch -d -r remote_name/branch_name
- reset your current project to match the repo (on origin master):
git reset --hard origin/master