So you’ve ordered a block of static IP’s from AT&T for use at home. You’re tired of forwarding a million custom external ports to non matching internal ports. You want to use them to point to various hosts, virtual machines, and devices behind AT&T’s modem/router combo or your router which is behind their modem/ruoter.
Obtain your IP block information
The first step to getting this all set up is knowing the correct information about the static IP block that you have been assigned. These are assigned in blocks of 8, 16, 32, etc… One thing to note is that 3 of the IP’s out of your block will not be usable by you. Those 3 represent the network, gateway, and broadcast addresses.
If you’re like me, I’m sure you’ve been in a situation where your SSH session is hung and you simply need to kill it so you can reconnect or get on with your business. I generally either just close the pane or window and reopen it or find the process from a different window and kill it from there. I got tired of this today and decided to find out how to kill it the right way.
Sure enough there is a very simply and easy way to kill a hung session!
~.
I hope this helps save some time in your day… I know it will for me!
There is no straight forward way built into Windows 7 to reverse the scrolling direction for your mouse. If you’re like me, you primarily use a Mac with OSX. Once you get used to the natural scrolling, its kind of nice. I got tired of trying to wrap my brain around switching back and forth between different scrolling directions when at work or home and decided to find a way to switch my Windows 7 machine to match my Mac.
There are two real ways to do this…
Option One
This is the way I chose. I chose this becuase finding the registry key for my house was not straight forward. The logitech driver overrides the hardware tab in the windows control panel which you would use to find the key.
Open power Windows Power Shell by browsing to Start Menu > All Applications > Accessories > Windows PowerShell
Wait until you see a prompt that looks something like this…
All done. You may need to unplug your mouse and plug it back in or reboot to see your changes.
Option Two
This is the manual way of doing things. You will change a flag in the Windows registry to get the desired effect.
Open the “Mouse Properties” dialog in your control panel and click on the “Hardware” tab.
Open the device properties window by clicking on the “Properties” button in the bottom right corner just above the “Apply” and “Help” buttons.
In the device properties dialogue window, click on the “Details” tab and select “Hardwire Ids” from the “Property” drop-down list. You should see a list of entries starting with “HID…”. Write down the values that start with “HID\VID_???…”.
Close device properties by clicking “Cancel”.
Close “Mouse Properties” by clicking “Cancel”.
Find and open the application “regedt32.exe” as an administrator, if you are not already logged in as one.
Navigate to “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID”, and look for an entry that resembles the “VID_???…” number that you wrote down earlier in step 3.
Open each child entry under your specified “VID_???…” key, and open the “Device Parameters” key. In my case, there were two child entries with a long “serial number”-like alphanumeric text string.
There should be a key named “FlipFlopWheel” under each of the “Device Parameters” key. Reverse the entry value for the “FlipFlopWheel”. i.e. if default is “0” (zero) change it to “1”, and vice-versa.
Do the same step 9, for each alphanumeric text string key entry, and their “Device Parameters”, “FlipFlopWheel”.
Close “regedt32.exe”.
Unplug your USB mouse, and listen or watch for Windows 7’s acknowledgement and confirmation that it has recognized the event of the mouse being unplugged. In my case, it was simply a “USB device unplugged” system sound. Re-connect the mouse and the new settings should have taken effect. If not, simply shutdown and restart Windows 7.
Issues due to differences in file encoding can sometimes be elusive and frustrating. I’ve found a few little tricks to uncover where the issue exists and to fix the problem.
If you have an idea of which file the characters are, you can use cat to display all characters and adds a $ to the end of your lines so that you can confirm that there are no special characters hiding in each line.
1
cat -vet filename
The options…
12345
-e equivalent to -vE
-E, --show-ends display $ at end of each line
-t equivalent to -vT
-T, --show-tabs display TAB characters as ^I
-v, --show-nonprinting use ^ and M- notation, except for LFD and TAB
Determine what character encoding is used by a file like so…
1
file -bi [filename]
Use VIM to change a file’s encoding
12
set encoding=utf-8
set fileencoding=utf-8
You will only notice a difference if you add utf-8 characters. Most characters on the keyboard will create a unicode equivalent if you hold down the alt key.
After intalling my new Octopress blog I figured it might be appropriate to write a blog about installing Octopress! The process was fairly easy but I found that going into it I’d made a few assumptions that were a little bit misleading. After getting over a couple of mental speed bumps, tiny ones really, I’m up and running with a brand new blog!
Assumptions
Octopress is a package of software that I will unpack into a directory on my web server and I will browse to it to administrate the setup and create posts
This was completely wrong. Come to find, its a good bit neater than this. You unpack or checkout the source onto a *nix or osx machine, fill out a simple config file, then use rake to build and then publish your site locally or remotely. After it has been published, it is a static site.
I will need to set up a database to hook Octopress into
After messing with Wordpress and Drupal for many years, I pretty much assume that every blog suite will need a DB. This is not the case. Since Octopress builds your blog at your command, you publish static content so there is no need for a DB or even logging into an interface via the web. You do all of your blogging hackerstyle from the command line!
Installation
Steps…
Install and Ruby
Install Octopress (really just checking out a git repo)
Configure Octopress
Configure your Web Server
Install Ruby
This step will differ greatly depending on what opreating system you’re installing this on. Generally you might want to install RVM to manage your ruby versions and then install ruby using RVM. I am serving this off of a server running CentOS so it was a little different for me…
Here was my process
Remove old ruby
1
$ yum remove ruby
Install dependencies
123456789
$ yum groupinstall "Development Tools"$ yum install zlib zlib-devel
$ yum install openssl-devel
$ wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
$ tar xzvf yaml-0.1.4.tar.gz
$ cd yaml-0.1.4
$ ./configure
$ make
$ make install
Install ruby
123456
$ wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
$ tar zxf ruby-1.9.3-p194.tar.gz
$ cd ruby-1.9.3-p194
$ ./configure
$ make
$ make install
Update rubygems
12
$ gem update --system
$ gem install bundler
Test ruby and rubygems are working
123
#Close shell and reopen for changes to take effect$ruby -v
$gem --version
You need to edit a few configuration options for Octopress.
_config.yml
Edit this file and configure the first few lines to your liking. You can see below how I configured mine. There are more configuration options near the bottom of the file that you can explore.
123456
url: http://phutchins.com
title: Philip Hutchins
subtitle: Head in the cloud...
author: Philip Hutchins
simple_search: http://google.com/search
description:
Rakefile
Edit this file to configure the way your blog deploys
12345678
## -- Rsync Deploy config -- ### Be sure your public key is listed in your server's ~/.ssh/authorized_keys filessh_user="phutchins@phutchins.com"ssh_port="22"document_root="/var/www/vhosts/phutchins.com/httpdocs/"rsync_delete=falsersync_args=""# Any extra arguments to pass to rsyncdeploy_default="rsync"
Configure your Web Server
If you havent set up a site for this yet, you’ll need to copy the default site and give it a name for your new site
12
$ cd /etc/apache2/sites-available
$ sudo cp default mysite
Open your new configuration file with vim or your favorite text editor
1
$ sudo vim mysite
Lines that need to be changed are labeled with comments above. /var/www is the default directory so you will need to change that to the directory where you want to host your Octopress public folder out of. You can either point directly to the public folder or use the rake deploy function of Octopress to push your site to the web sites /var/www dir. I recommend the second option.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
<!-- point the line below to Octopress's public folder --> DocumentRoot /path/to/octopress/public/folder <Directory /> Options FollowSymLinks AllowOverride None </Directory> <!-- point the line below to Octopress's public folder -->
<Directory /path/to/octopress/public/folder >
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,# alert, emerg. LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
Lastly, you’ll need to restart apache
1
$ sudo service apache2 reload
All done! Now you should be able to browse to the URL or IP of your Apache server and view your site. At this point it will be pretty empty and bare so lets move on to making your first blog post.
Your first post
As Octopress is based on Jekyll, it offers rake tasks to create posts and pages that have some basic metadata included in them. It also wil generate global categories for you ass you add them to your posts and pages.
Adding a Blog Post
To create a post you use rake. Just replace “My Blog Title” with your title.
1
rake new_post["My Blog Title"]
This creates a file for your post in the source/_posts directory named with the date that you created it and a munged version of the title you used. By default, these are created as a Markdown files. Navigate to your newly created file and you will see something like this…
1234567
---
layout: post
title: "My Blog Title"date: 2013-09-14 00:21
comments: truecategories: [Blog, Awesome]---
Creating the post
Once you have the post file created, you can begin to add your content below the last set of three dashes. You work with simple text but why stop there when you have Markdown??
Working with Markup
Markdown lets you do a lot so I’ll only cover a few simple things here.
Headers
You can create headers in a few ways.
The above header is created like this. You can add are remove #’s to change the size. A single # represents a H1 while three #’s represents an H3 and so on.
1
##### Headers
Underlining text with equals or dashes creates H1’s and H2’s respectively.
12345
This is an H1=============This is an H2
-------------
It does not matter how many equals or dashes you use. Any number will work
Code Blocks
For a code block, you can indent lines with a tab or 4 spaces. You can also use “` before and after your code. To specify the type of highlighting use something like this…
To generate your blog, simply run rake generate. This will create the blog and all files required for it in the public folder.
Then to publish to the location you configured in Rakefile, run rake deploy. This will push your public folder to the configed location.
Managing your Content
There are a few ways that you can manage your blog. I’m current using a git repo to store the entire Octopress codebase. This allows you to not only edit and make updates from many locations but it also gives you the ability to use git as a way to publish.
Overall thoughts…
Octopress is pretty easy to use and great for someone that doesn’t mind a little hacking. Even better for someone that likes a little hacking. :) If you’re like me, you hate when gui editors change something that you’ve typed or created becuase it thinks it knows better than you do.