Viewing Category : programming

Post thumbnail of How to push pop shift and unshift arrays in bash
18 November 2010
Continue reading How to push pop shift and unshift arrays in bash

How to push pop shift and unshift arrays in bash

Since you can’t really pass pointers or references to arrays and you can’t return anything other than integers, here’s how to implement push, pop, shift, and unshift in a bash shell script. I don’t know if this already exists in bash, but I couldn’t find it and I needed a data structure in a hurry.

Post thumbnail of 25 years of X
17 November 2010
Continue reading 25 years of X

25 years of X

It’s hard to believe X has been around since 1985. Most people expect all applications to use X, and modern Linux operating systems seem to be reimplementing all kinds of applications to incorporate graphical interfaces. The combination of layers available when developing an application that uses X is staggering.

Post thumbnail of Portable Python - preconfigured portable programming environment
13 October 2010
Continue reading Portable Python - preconfigured portable programming environment

Portable Python - preconfigured portable programming environment

ver wish you could test your code on a machine that’s not connected to teh interwebs and doesn’t have python installed? I like portable applications for many reasons, mainly because they just work.

Post thumbnail of Tab completion for python in VIM
20 September 2010
Continue reading Tab completion for python in VIM

Tab completion for python in VIM

nstallation is easy. Just put the .vim file in ~/.vim/after/ftplugin/ and put the dictionary file somewhere else. Then add two lines to your .vimrc and that’s it. Just hit tab and it will give you a drop down menu allowing you to auto-complete if your cursor is sitting just after a keyword.

Post thumbnail of The most useful and complete sed tutorial
9 August 2010
Continue reading The most useful and complete sed tutorial

The most useful and complete sed tutorial

Everything you ever wanted to know about the stream editor sed. Pattern matching, delimiters, deletion, ranges, grouping, all explained.

Post thumbnail of Bash integer counter just like in C
6 August 2010
Continue reading Bash integer counter just like in C

Bash integer counter just like in C

In almost all high level languages you can do something similar to x++ to increment an integer counter. Bash doesn’t have an incrementer, but you can still make your own integer counter using back-ticks and expr.

Post thumbnail of Automate rpmbuilds from spec files including name-version-build info automatically
28 June 2010
Continue reading Automate rpmbuilds from spec files including name-version-build info automatically

Automate rpmbuilds from spec files including name-version-build info automatically

Start the spec file with %define statements at the top. Continue the spec file as you would normally, using the variables you just defined in place of the real name, version, build. Create an rpmbuild script that replaces the template variables with current information. Make an rpm target in your Makefile that calls the rpmbuild script.

Post thumbnail of Two ways to change case lowercase to uppercase using sed
22 June 2010
Continue reading Two ways to change case lowercase to uppercase using sed

Two ways to change case lowercase to uppercase using sed

Change lowercase to uppercase or vice versa using sed the brute force easy way and the smart way. One use of this would be finding the hardware address of an interface and converting it to all uppercase.

Post thumbnail of Bash One-liner to get IP address for each network interface
15 June 2010
Continue reading Bash One-liner to get IP address for each network interface

Bash One-liner to get IP address for each network interface

This one should be pretty bulletproof. Use a single sed command to dump the list of all ip addresses from interfaces showing in ifconfig.

Post thumbnail of Use awk to figure out your ip address from ifconfig for a bash script
3 June 2010
Continue reading Use awk to figure out your ip address from ifconfig for a bash script

Use awk to figure out your ip address from ifconfig for a bash script

99% of the time you can just use the local address to talk to yourself. This is just an example to show you how wrangle the ip address using awk. Rewrite the hosts file so the host itself can use it’s external address by name. Write out the basic stuff in hosts that doesn’t change then write out the current IP address.

 Page 2 of 7 « 1  2  3  4  5 » ...  Last » 
Powered by Wordpress   |   Lunated designed by ZenVerse