28 Apr

the other side of me… Yes i’m a DJ and Event Host

So its no secret that i have passion for music since i was young toddler. Before getting my hands dirty in the tech space I was a part-time mobile dj .. By Part time i mean working Friday, Saturday and Sunday’s doing various different events from Birthday Parties, to Life events such as Christenings and Weddings. Couple years ago i took break from DJing to focus on my career and my consulting business in Tech. It wasn’t till I met a client who became a great friend that inspired me to get back into music. So flash-forward 9+ years later I’m still heavy at it working for various companies in the Tri-State area and finally planting some seeds with my family at Ultrafonk Entertainment  . Along the way I learn from Various Different DJ’s and Emcee’s the different ways to Host events and proper business etiquette for dealing with clients when hosting events.

One of the things that I do in my spare time is that I record mixes and publicize them on social media. I’ve learned that this technique helps increase my marketable skills in the event hosting space by showcasing my music programming talents. A couple years ago I experimented with doing my own custom remixes and edits I was so lucky that one of my works was featured on a music compilation cd in Switzerland. Having my track featured on this compilation was a crowning moment for me. Now one of the things that I enjoyed with my mixes is some of the feedback I get from listeners. Some of the listener feedback that comes in is amazing especially reading emails from people that are in different parts of the world like from places in Asia, South America and Europe.

There’s one thing that I’ve learned that as a good DJ you have to be very open-minded and not be one-sided with musical genres. In the event space we take that pretty serious because throughout the night you’re playing multiple genres sometimes event playing music from different ethnic backgrounds and being able to fuse those together takes some skills. One skill that I still master to this day is kind of reading the crowd being able to determine what would work musical wise and what wouldn’t work but on occasion you get the occasional request from guest that makes you ponder whether you should play it or you shouldn’t play it because you know in that it would be a dance floor kryptonite.

 

So I made it a personal goal every month since the start of the new year to attempt to record at least one or two mixes a month and upload them to sites like mixcloud.com and mixcrate.com  but then I forgot that I have this website blog that I use for my tech ramblings. So I decided I am going to start posting my mixes on my personal blog as well as the other to upload sites. So I look forward to see if this helps increase some more views on my personal blog.

28 Apr

April OpenFormat Part II

Track list for this Mix

1.Real Love (Simo Segue DMS)by Mary J Blige x Shoe Scene Symphony x Clean Bandit
2.Workship by Years & Years
3.I Wanna Dance with Somebody(Naxsy Remix) by Whitney Houston
4.Stole The Show (Dunisco RMX / Cutdown) by Kygo Ft. Parson James
5.Snow (Jondai RMX / Cutdown) by Red Hot Chili Peppers
6.Uptown Funk (Jump On It Aca Out / Short Edit) by Mark Ronson ft Bruno Mars
7.Outside (Funk LeBlanc RMX) by Calvin Harris Ft. Ellie Goulding
8.Heroes (Basic Tape RMX) by Alesso Ft. Tove Lo
9.Lean On (Danny Diggz Transition 120-98) – by Major Lazer & DJ Snake feat. MØ

15 Dec

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

25 Jun

Stuck in Command Line but want to know how your team is doing in the world cup

So i was stuck debugging an application that forced me to be glued to cli. Unable to keep tabs on the game i was able to figure out how to display it in my tmux session tab using the following commands

watch -n10 --no-title "w3m http://www.livescore.com/ |egrep 'live [0-9H] [^ ]'"

31 Mar

iptables snips

iptables snippets

iptables is the default firewall you see on any linux computer. It works by allowing (ACCEPTing) or denying (DROPing) connections to the local computer. There are basically three scenarios you can deal with:

  1. INPUT: Connections generated from a different computer targeting yours; for example, when you run a web server on your computer and others want to connect to it.
  2. OUTPUT: Connections generated from your computer targeting other computers; for example, when you open a web page or open a remote ssh session.
  3. FORWARD: Connections generated from computers different than your, but that use your computer as a link to get to other computers; for example, when you share your computer’s internet connection with others, that is, when you use your computer as a router for others.

iptables

 

Here I have a small compilation of some useful tasks for iptables. I hope you find them useful.

 

Adding rules

iptables -A INPUT -i lo -j ACCEPT

What it does: Instructs iptables to allow all incoming connection from localhost. This is a required rule, since many programs use TCP to make local connections.
iptables -A INPUT -p tcp --dport 22 -j ACCEPT

What it does: Opens port 22 (SSH) to TCP connections coming from any computer.
iptables -A INPUT -p tcp -s 192.168.1.2 --dport 3306 -j ACCEPT

What it does: Opens port 3306 (MySQL) to TCP connections coming from IP address 192.168.1.2.
iptables -A INPUT -p udp --dport 53 -j ACCEPT

What it does: Opens port 53 (DNS) to UDP connections coming from any computer. Important: DNS requires both UDP and TCP to work properly.
iptables -P INPUT DROP

What it does: Denies all incoming connections (generated from the outside world to your computer), no matter what port you are trying to connect to.
iptables -P FORWARD DROP

What it does: Denies all forwarding connections. If you do this, your computer will not work if you want to share your computer’s internet connection to other computers. You usually want to deny it.
iptables -P OUTPUT ACCEPT

What it does: Allows all connections generated from the local computer (localhost) to the outside world. If you do not allow them, you will not be able to surf the web!

 

Listing current rules

iptables -L

What it does: Prints the list of current rules.
iptables -vL

What it does: Prints the list of current rules, but includes more information (v = verbose).
iptables -vnL --line-numbers

What it does: Prints the list of current rules including a column with line numbers; They are useful to make reference to a particular rule by number.

 

Deleting a rule

iptables -D INPUT -s 192.168.1.1 -p tcp --dport 111 -j ACCEPT

What it does: Deletes the rule that allows TCP connections on port 111 from IP address 192.168.1.1.
iptables -D INPUT 4

What it does: Deletes rule number 4. (Do you remember how to print the list of rules along with its line numbers? Well, this is an easy way to delete a rule.)
iptables -F

What it does: Deletes all the rules (F = flush). Be careful when you run this!

 

Saving your current rules

/sbin/service iptables save

What it does: Saves the current rules to disk, so they are applied next time you turn your computer on.

 

A full example

iptables -F
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
/sbin/service iptables save
iptables -vL

An important thing to keep in mind is that all rules are applied from top to bottom. If you have a DROP rule before an ACCEPT rule, then the rule with the DROP wins. It is important that you add your rules in the order that you want them to be evaluated.

Here’s what the previous snippet does:

  1. Deletes all the rules
  2. Adds a rule to accept all incoming data packages coming from localhost. This is a must!
  3. This one is tricky. It loads iptables state module (-m state) and instructs it to allow all data packages from established and related connections. What??? We’ll get back to this in a moment…
  4. Adds a rule to accept TCP connections on port 22 (SSH) from any computer.
  5. Adds a rule to accept TCP connections on port 80 (Web) from any computer.
  6. Drops any incoming data packages. Wait, what??? Yes, remember that rules are evaluated from top to bottom. If we receive a connection request on port 80 (line 5), it will be accepted, because that rule is before this one. The same will happen to local connections (because of line 2) and SSH connections (because of line 4). If we would place this droprule on line 2, then we would be effectively blocking all incoming connections.
  7. Drops any forwarding package. We are not using our computer as a router, so this is the best.
  8. Allow all outgoing packages. So we can check Facebook!
  9. Save it. If you do not save it, all your work will be lost next time you restart your computer.
  10. Finally, take a look at it.

What about line 3? Well, it says, all data packages coming over a previously allowed connection, that is one from localhost or on ports 22 or 80, will be accepted without further checking. If your computer receives a new request for a web page (on port 80, of course) iptables will start checking all rules, one by one, starting by the first one. The one that will allow the connection is the rule on line 5. So data packages coming from that computer, using that same connection, will be allowed because there is an active and previously established connection. This is useful because this way iptables does not have to check all the rules again.

 

Some more iptables snippets

iptables -A INPUT -p tcp --dport 22 -j ACCEPT

What it does: Allows SSH connections to local computer
iptables -A INPUT -p tcp --dport 80 -j ACCEPT

What it does: Allows web connections to local computer
iptables -A INPUT -p udp --dport 53 -j ACCEPT
iptables -A INPUT -p tcp --dport 53 -j ACCEPT

What it does: Allows DNS connections to local computer
iptables -A INPUT -p udp --dport 137 -j ACCEPT
iptables -A INPUT -p udp --dport 138 -j ACCEPT
iptables -A INPUT -p udp --dport 139 -j ACCEPT
iptables -A INPUT -p tcp --dport 137 -j ACCEPT
iptables -A INPUT -p tcp --dport 138 -j ACCEPT
iptables -A INPUT -p tcp --dport 139 -j ACCEPT

What it does: Allows SMB (Windows sharing) connections to local computer
iptables -A INPUT -p tcp -s 192.168.1.2 --dport 3306 -j ACCEPT

What it does: Allows MySQL remote connections from IP address 192.168.1.2

 

See you soon!

28 Mar

Useful Bash Aliases and Functions

The more you operate on the command line, the more you will find that the majority of the commands you use are a very small subset of the available commands. Most tasks are habitual and you may run these the same way every day.

While the makers of many of the most common command utilities have attempted to eliminate extraneous typing by using shortened names (think of how many keystrokes you save daily by typing “ls” instead of “list” and “cd” instead of “change-directory”), these are not ubiquitous. Additionally, many people always run commands with the same few options enabled every time.

Luckily, bash allows us to create our own shortcuts and time-savers through the use of aliases and shell functions. i’ll discuss how to make use of these and give you some useful examples to get you started in the right direction.

 

How To Declare a Bash Alias

Declaring aliases in bash is very straight forward. It’s so easy that you should try it now.

You can declare aliases that will last as long as your shell session by simply typing these into the command line. The syntax looks like this:

alias alias_name="command_to_run"

Note that there is no spacing between between the neighbor elements and the equal sign. This is not optional. Spaces here will break the command.

Let’s create a common bash alias now. One idiomatic command phrase that many people use frequently is ls -lha or ls -lhA (the second omits the current and parent directory listing). We can create a shortcut that can be called as ll by typing:

[[code]]czoxODpcImFsaWFzIGxsPVwibHMgLWxoQVwiXCI7e1smKiZdfQ==[[/code]]

Now, we can type ll and we’ll get the current directory’s listing, in long format, including hidden directories:
[[code]]czoyOlwibGxcIjt7WyYqJl19[[/code]]

[[code]]czo0MTA6XCItcnctci0tci0tIDEgcm9vdCByb290IDMuMEsgTWFyIDIwIDE4OjAzIC5iYXNoX2hpc3RvcnkNCi1ydy1yLS1yLS0gMSB7WyYqJl19cm9vdCByb290IDMuMUsgQXByIDE5ICAyMDEyIC5iYXNocmMNCmRyd3gtLS0tLS0gMiByb290IHJvb3QgNC4wSyBPY3QgMjQgMTQ6NHtbJiomXX01IC5jYWNoZQ0KZHJ3eC0tLS0tLSAyIHJvb3Qgcm9vdCA0LjBLIE1hciAyMCAxODowMCAuZ251cGcNCi1ydy1yLS1yLS0gMSByb290e1smKiZdfSByb290ICAgIDAgT2N0IDI0IDE3OjAzIC5teXNxbF9oaXN0b3J5DQotcnctci0tci0tIDEgcm9vdCByb290ICAxNDAgQXByIDE5ICB7WyYqJl19MjAxMiAucHJvZmlsZQ0KZHJ3eC0tLS0tLSAyIHJvb3Qgcm9vdCA0LjBLIE9jdCAyNCAxNDoyMSAuc3NoDQotcnctLS0tLS0tIDEgcntbJiomXX1vb3Qgcm9vdCAzLjVLIE1hciAyMCAxNzoyNCAudmltaW5mbw0KXCI7e1smKiZdfQ==[[/code]]

If you want to get rid of an alias, just use the unalias command:
[[code]]czoxMjpcInVuYWxpYXMgbGwNClwiO3tbJiomXX0=[[/code]]

The alias is now removed.

You can list all of your configured aliases by passing the alias command without any arguments:

[[code]]czo3OlwiYWxpYXMNClwiO3tbJiomXX0=[[/code]]

To temporarily bypass an alias (say we aliased ls to ls -a), we can type:
[[code]]czo1OlwiXFxscw0KXCI7e1smKiZdfQ==[[/code]]

This will call the normal command found in our path, without using the aliased version.

Assuming you did not unset it, the ll alias will be available throughout the current shell session, but when you open a new terminal window, this will not be available.

To make this persistent, we need to add this into one of the various files that is read when a shell session begins. Popular choices are ~/.bashrc and ~/.bash_profile. We just need to open the file and add the alias there:

[[code]]czoxNjpcIm5hbm8gfi8uYmFzaHJjDQpcIjt7WyYqJl19[[/code]]

At the bottom or wherever you’d like, add the alias you added on the command line. Feel free to add a comment declaring an entire section devoted to bash aliases:
[[code]]czo1NTpcIiMjIyMjIyMjIw0KIyBBbGlhc2VzDQojIyMjIyMjIyMNCg0KYWxpYXMgbGw9XCJscyAtbGhBXCINClwiO3tbJiomXX0=[[/code]]

This alias or a variation might actually already be in your file. Many distributions ship with a set of standard bash configuration files with a few useful aliases.

Save and close the file. Any aliases you added will be available next time you start a new shell session. To read any changes you made in your file into yourcurrent session, just tell bash to re-read the file now:

[[code]]czoxODpcInNvdXJjZSB+Ly5iYXNocmMNClwiO3tbJiomXX0=[[/code]]

Alias Examples

Now that you know how to create your own aliases, let’s talk about some popular ones that may be useful to you. These can be found throughout the web, and some may also be included in your distribution’s default bash configuration as well.

Navigation and Listing

Many of the most simple Linux commands are more helpful when you apply some formatting and options.

We discussed one ls example above, but there are many others you may find.

Make ls display in columns and with a file type indicator (end directories with “/”, etc) by default:

[[code]]czoxOTpcImFsaWFzIGxzPVwibHMgLUNGXCINClwiO3tbJiomXX0=[[/code]]

We can also anticipate some typos to make it call the correct command:
[[code]]czoxNTpcImFsaWFzIHNsPVwibHNcIg0KXCI7e1smKiZdfQ==[[/code]]

Let’s also make an alias to pipe our output to less for viewing large directory listings with the long format:
[[code]]czoyOTpcImFsaWFzIGxzbD1cImxzIC1saEZBIHwgbGVzc1wiDQpcIjt7WyYqJl19[[/code]]

How about we stray from ls and try some helpful commands for cd.

This one will change to your parent directory, even when you forget the space:

[[code]]czoyMDpcImFsaWFzIGNkLi49XCJjZCAuLlwiDQpcIjt7WyYqJl19[[/code]]

You can also cut out the cd part entirely by making an alias for ..:
[[code]]czoxODpcImFsaWFzIC4uPVwiY2QgLi5cIg0KXCI7e1smKiZdfQ==[[/code]]

We can find files in our current directory easily by setting this alias:
[[code]]czoyOTpcImFsaWFzIGZoZXJlPVwiZmluZCAuIC1uYW1lIFwiDQpcIjt7WyYqJl19[[/code]]

System Aliases

How about some of our monitoring and system stats commands? I call these with the same options every time, so I might as well make some aliases.

This one will list our disk usage in human-readable units including filesystem type, and print a total at the bottom:

[[code]]czoyODpcImFsaWFzIGRmPVwiZGYgLVRoYSAtLXRvdGFsXCINClwiO3tbJiomXX0=[[/code]]

We might as well add an alias for our preferred du output as well:
[[code]]czozMDpcImFsaWFzIGR1PVwiZHUgLWFjaCB8IHNvcnQgLWhcIg0KXCI7e1smKiZdfQ==[[/code]]

Let’s keep going in the same direction by making our free output more human friendly:
[[code]]czoyMzpcImFsaWFzIGZyZWU9XCJmcmVlIC1tdFwiDQpcIjt7WyYqJl19[[/code]]

We can do a lot with our listing process table. Let’s start out by setting a default output:
[[code]]czoyMDpcImFsaWFzIHBzPVwicHMgYXV4ZlwiDQpcIjt7WyYqJl19[[/code]]

How about we make our process table searchable. We can create an alias that searches our process for an argument we’ll pass:
[[code]]czo1NTpcImFsaWFzIHBzZz1cInBzIGF1eCB8IGdyZXAgLXYgZ3JlcCB8IGdyZXAgLWkgLWUgVlNaIC1lXCINClwiO3tbJiomXX0=[[/code]]

Now, when we call it with the process name we’re looking for as an argument, we’ll get a nice, compact output:
[[code]]czoxMDpcInBzZyBiYXNoDQpcIjt7WyYqJl19[[/code]]

[[code]]czoxNDU6XCJVU0VSICAgICAgIFBJRCAlQ1BVICVNRU0gICAgVlNaICAgUlNTIFRUWSAgICAgIFNUQVQgU1RBUlQgICBUSU1FIENPTU17WyYqJl19QU5EDQoxMDAxICAgICAgNTIyNyAgMC4wICAwLjAgIDI2MzIwICAzMzc2IHB0cy8wICAgIFNzICAgMTY6MjkgICAwOjAwIGJhc2gNCntbJiomXX1cIjt7WyYqJl19[[/code]]

Miscellaneous Aliases

One common option to the mkdir command that we use often is the -p flag to make any necessary parent directories. We can make this the default:

[[code]]czoyNDpcImFsaWFzIG1rZGlyPVwibWtkaXIgLXBcIg0KXCI7e1smKiZdfQ==[[/code]]

We might want to add a -v flag on top of that so we are told of every directory creation, which can help us recognize quickly if we had a typo which caused an accidental directory branch:
[[code]]czoyNTpcImFsaWFzIG1rZGlyPVwibWtkaXIgLXB2XCINClwiO3tbJiomXX0=[[/code]]

When downloading files from the internet with wget, in almost all circumstances, you’ll want to pass the -c flag in order to continue the download in case of problems. We can set that with this:
[[code]]czoyMjpcImFsaWFzIHdnZXQ9XCJ3Z2V0IC1jXCINClwiO3tbJiomXX0=[[/code]]

We can search our history easily like with a grep of the history command’s output. This is sometimes more useful than using CTRL-R to reverse search because it gives you the command number to do more complex recalls afterwards:
[[code]]czozMDpcImFsaWFzIGhpc3RnPVwiaGlzdG9yeSB8IGdyZXBcIg0KXCI7e1smKiZdfQ==[[/code]]

I have a few system tools that I prefer to upgrade from the standard version to more complex tools. These will only work if you’ve downloaded the required utilities, but they can be very helpful. Keep in mind that these may affect your other aliases.

This one replaces the conventional top command with an enhanced version that is much easier on the eyes and can be sorted, searched, and scrolled without complications:

[[code]]czoxODpcImFsaWFzIHRvcD1cImh0b3BcIg0KXCI7e1smKiZdfQ==[[/code]]

In a similar way, the ncdu command can be downloaded which presents file and directory sizes in an interactive ncurses display that you can browse and use to perform simple file actions:
[[code]]czoxNzpcImFsaWFzIGR1PVwibmNkdVwiDQpcIjt7WyYqJl19[[/code]]

There’s an upgraded utility for df as well that’s called pydf. It provides colorized output and text-based usage bars. We can default to using this utility if we have it:
[[code]]czoxNzpcImFsaWFzIGRmPVwicHlkZlwiDQpcIjt7WyYqJl19[[/code]]

Have you ever needed your public IP address from the command line when you’re behind a router using NAT? Something like this could be useful:
[[code]]czo0OTpcImFsaWFzIG15aXA9XCJjdXJsIGh0dHA6Ly9pcGVjaG8ubmV0L3BsYWluOyBlY2hvXCINClwiO3tbJiomXX0=[[/code]]

For my own purposes, I like to optimize the images I upload for articles to be 690px or less, so I use the ImageMagick package (sudo apt-get install imagemagick if not already available) which contains a command called mogrify that does just this. I have this command in my ~/.bashrc file:
[[code]]czo0NzpcImFsaWFzIHdlYmlmeT1cIm1vZ3JpZnkgLXJlc2l6ZSA2OTBcXCZndDsgKi5wbmdcIg0KXCI7e1smKiZdfQ==[[/code]]

This will resize all of the PNG images in the current directory, only if they are wider than 690px.

If I then have to upload them to a server, I can use sftp to connect and automatically change to a specific directory:

alias upload="sftp username@server.com:/path/to/upload/directory

Getting Started with Bash Functions

Although aliases are quick and easy to implement, they are quite limited in their scope. You’ll find as you’re trying to chain commands together that you can’t access arguments given at runtime very well, among other things. Aliases can also be quite slow at times because they are read after all functions.

There is an alternative to aliases that is more robust and can help you bridge the gap between bash aliases and full shell scripts. These are called shell functions. They work in almost the same way as aliases but are more programmatic and accept input in a standard way.

We won’t go into extensive detail here, because these can be used in so many complex situations and bash is an entire scripting language, but we’ll go over some basic examples.

For starters, there are two basic ways to declare a bash syntax. The first uses the function command and looks something like this:

function function_name {
    command1
    command2
}

The other syntax uses a set of parentheses which is more “C-like”:
function_name () {
    command1
    command2
}

We can compress this second form into one line and separate the commands with semicolons. A semicolon must come after the last command too:
function_name () { command1; command2; }

Let’s start off by demonstrating an extremely useful bash function. This one will create a directory and then immediately move into that directory. This is usually exactly the sequence we take when making new directories:
[[code]]czo0MTpcIm1jZCAoKSB7DQogICAgbWtkaXIgLXAgJDENCiAgICBjZCAkMQ0KfQ0KXCI7e1smKiZdfQ==[[/code]]

Now, when we use use this function instead of the regular mkdir command to auto change into the directory after creation:
[[code]]czoxNTpcIm1jZCB0ZXN0DQpwd2QNClwiO3tbJiomXX0=[[/code]]

[[code]]czoyMTpcIi9ob21lL2RlbW91c2VyL3Rlc3QNClwiO3tbJiomXX0=[[/code]]

One cool function that you’ll see around is the extract function. This combines a lot of utilities to allow you to decompress just about any compressed file format. There are a number of variations, but this one comes from here:
[[code]]czoxMTUzOlwiZnVuY3Rpb24gZXh0cmFjdCB7DQogaWYgWyAteiBcIiQxXCIgXTsgdGhlbg0KICAgICMgZGlzcGxheSB1c2FnZSBpZiBub3tbJiomXX0gcGFyYW1ldGVycyBnaXZlbg0KICAgIGVjaG8gXCJVc2FnZTogZXh0cmFjdCAmbHQ7cGF0aC9maWxlX25hbWUmZ3Q7LiZsdDt6aXB8cntbJiomXX1hcnxiejJ8Z3p8dGFyfHRiejJ8dGd6fFp8N3p8eHp8ZXh8dGFyLmJ6Mnx0YXIuZ3p8dGFyLnh6Jmd0O1wiDQogZWxzZQ0KICAgIGlmIHtbJiomXX1bIC1mICQxIF0gOyB0aGVuDQogICAgICAgICMgTkFNRT0kezElLip9DQogICAgICAgICMgbWtkaXIgJE5BTUUgJmFtcDsmYW1wOyBje1smKiZdfWQgJE5BTUUNCiAgICAgICAgY2FzZSAkMSBpbg0KICAgICAgICAgICoudGFyLmJ6MikgICB0YXIgeHZqZiAuLi8kMSAgICA7Ow0KICB7WyYqJl19ICAgICAgICAqLnRhci5neikgICAgdGFyIHh2emYgLi4vJDEgICAgOzsNCiAgICAgICAgICAqLnRhci54eikgICAgdGFyIHh2SmYgLntbJiomXX0uLyQxICAgIDs7DQogICAgICAgICAgKi5sem1hKSAgICAgIHVubHptYSAuLi8kMSAgICAgIDs7DQogICAgICAgICAgKi5iejIpICAge1smKiZdfSAgICBidW56aXAyIC4uLyQxICAgICA7Ow0KICAgICAgICAgICoucmFyKSAgICAgICB1bnJhciB4IC1hZCAuLi8kMSA7Ow0KICAgICB7WyYqJl19ICAgICAqLmd6KSAgICAgICAgZ3VuemlwIC4uLyQxICAgICAgOzsNCiAgICAgICAgICAqLnRhcikgICAgICAgdGFyIHh2ZiAuLi8kMXtbJiomXX0gICAgIDs7DQogICAgICAgICAgKi50YnoyKSAgICAgIHRhciB4dmpmIC4uLyQxICAgIDs7DQogICAgICAgICAgKi50Z3opICAgICAge1smKiZdfSB0YXIgeHZ6ZiAuLi8kMSAgICA7Ow0KICAgICAgICAgICouemlwKSAgICAgICB1bnppcCAuLi8kMSAgICAgICA7Ow0KICAgICAgICB7WyYqJl19ICAqLlopICAgICAgICAgdW5jb21wcmVzcyAuLi8kMSAgOzsNCiAgICAgICAgICAqLjd6KSAgICAgICAgN3ogeCAuLi8kMSAgICAgIHtbJiomXX0gIDs7DQogICAgICAgICAgKi54eikgICAgICAgIHVueHogLi4vJDEgICAgICAgIDs7DQogICAgICAgICAgKi5leGUpICAgICAgIGNhe1smKiZdfWJleHRyYWN0IC4uLyQxICA7Ow0KICAgICAgICAgICopICAgICAgICAgICBlY2hvIFwiZXh0cmFjdDogXCckMVwnIC0gdW5rbm93biBhcmN7WyYqJl19aGl2ZSBtZXRob2RcIiA7Ow0KICAgICAgICBlc2FjDQogICAgZWxzZQ0KICAgICAgICBlY2hvIFwiJDEgLSBmaWxlIGRvZXMgbm90IGV4e1smKiZdfWlzdFwiDQogICAgZmkNCmZpDQp9DQpcIjt7WyYqJl19[[/code]]

This function takes the first argument and calls the appropriate utility program based on the file extension used.

Conclusion

Hopefully this  has given you some inspiration for creating your own aliases and bash functions. Extensive use of these can help make your time in the shell more enjoyable and less complex.

Remember to be wary of redefining existing commands with behavior that is potentially destructive. Even doing the opposite and aliasing a command to a safer variant (always asking for confirmation before deleting recursively, for instance) can come back to bite you the first time you’re on a system without it once you’ve come to rely on it.

To find candidates that might be good to create aliases for, it might be a good idea to search your history for your most commonly used commands. A one-liner from here allows us to see our most used commands:

[[code]]czoxNjc6XCJoaXN0b3J5IHwgYXdrIFwne0NNRFskMl0rKztjb3VudCsrO31FTkQgeyBmb3IgKGEgaW4gQ01EKXByaW50IENNRFthXSBcIntbJiomXX0gXCIgQ01EW2FdL2NvdW50KjEwMCBcIiUgXCIgYTt9XCcgfCBncmVwIC12IFwiLi9cIiB8IGNvbHVtbiAtYzMgLXMgXCIgXCIgLXQgfCBzb3J0IC17WyYqJl19bnIgfCBubCB8ICBoZWFkIC1uMTANClwiO3tbJiomXX0=[[/code]]

[[code]]czoyMTc6XCIgMSAgMjQ3ICAyNC43JSAgY2QNCiAyICAxMTIgIDExLjIlICB2aW0NCiAzICA5MCAgIDklICAgICBleGl0DQogNCAgNzJ7WyYqJl19ICAgNy4yJSAgIGxzDQogNSAgNzAgICA3JSAgICAgeHNldA0KIDYgIDU2ICAgNS42JSAgIGFwdC1nZXQNCiA3ICA0MCAgIDQlICAgIHtbJiomXX0gdmxjDQogOCAgNDAgICA0JSAgICAgcm0NCiA5ICAzOCAgIDMuOCUgICBzY3JlZW4NCjEwICAyNyAgIDIuNyUgICBodG9wDQpcIjt7WyYqJl19[[/code]]

 

28 Mar

The Return of the iPhone

apple-iphone-5s-silver-gold-black-540x334So i hate my self for typing this but i’m back on the iphone.. Yes the same person that did recent detox and went all in with Android.. Why  is the question your asking? Well  the answer i was updating my phone via my carriers latest update (VZW) and apparently an over the air update caused my phone to brick to the point that it wouldn’t boot up . So i took my phone over to the Verizon Store and tech support folks tried various things and still couldn’t get this phone un-bricked. Just my luck so at this point i was starting to loose my patience and was told that my insurance would replace my phone turns out that they didn’t have any Lg G2’s available but next best bet would be Samsung Galaxy S3 – i was like wait thats going backwards to slower phone i asked if i could talk to manager or supervisor so after talking with them we came to compromise that they would refund my money on the phone and i could use it towards new hardware so at this point as annoyed i opted to return to the Might Iphone in this case the 5s .. So your thinking well thats a good thing – Yes and No – Yes its iphone i have my apps and all my data pulled from the Cloud but then i have to get new charging cable and new case -etc etc .. After using both I’ve come to terms on what i like about both – for one thing The camera on the Iphone is bit more superior to anything on the Android Hardware unless that has change with the latest Galaxy S5 and Note 3 – The bluetooth 4.0 stack on the iphone is bit more refined compared to android but i’m hearing that in KitKat that this was resolved.  But one thing i miss is the ablity to swipe while texting and type just makes things easier.. vs the iphone and its awful auto correct. So do i see myself going back to the Android – possibly but only time will tell.

28 Mar

Hackintosh build

So it became apparent that my old 2007 imac was unable to keep up with my work – i upgrade ram , replace hard drive still felt weee bit slow. It was Core2duo Extreme by today’s standards it was a snail. So i’ve been following discussion on reddits.com/r/hackintosh and saw few users rave about there latest hackintosh builds – granted i was familiar with the process and dabbled with it many many years ago during the  leopard days but i saw that the community behind it was still updating so decide why not. So i gather the details of what i was looking to do and went to the main apple site and spec out mac pro workstation – after 3 mins of drooling the stick price was way over my intended budget – something in the neighborhood of $4500 bucks .. No bueno for me .. so i took those specs and compared to list of specs at the TonyMac site and found a build that just seem right both speed and price wise.  It was the CustoMac Pro (atx) build  so i order my parts all from amazon waited couple days later 6-7 boxs later i’m typing on my latest new machine.  Now the question is would i recommend this to any one? Well that depends if your into tweaking things learning how things work then yes but if your the type that just wants something to work right out of the box and can’t wait for fix then look away.  Granted my system is very stable since i avoid installing un necessary things.. My key items that i needed on this machine were – Browser, SSH Terminal, Audio and Video Editing Light though and Some Graphics Editing like photoshop.  So far i’m digging it and learning few tweaks at the same time.

 

 

03 Oct

Another attempt at an Apple iOS detox with LG G2

lgg2

So instead of getting another IPhone i decided to give Android another shot but this time with the LG G2 smart phone.  Its currently at this time of writing one of the fastest smart phones on the market running the Android OS  4.2.2  . I decided to give another try after researching and talking to few other people who have been following this phone and much to everybody’s response this phone is 100x better the the Samsung Galaxy S4 and the Iphone 5 and 5s.  One of the selling features to me about this phone was the fact that its display which is LCD IPS is very rich in with 423 ppi  pixel density and larger display then the current iphone and s4 . LG put a lot of time and effort into packing a very fast processor a quad core Qualcomm Snapdragon 800 MSM8974 with a graphics processor Adreno 330 which blows away its current competition .  Even though the Iphone 5s has as 64bit os and A7 it still early to say if there’s any significant difference in performance it will be year or two before we start seeing more 64bit Mobile OS’s hit the market. I was truly disappointed that the only feature that apple was able to pack onto the current Iphone was finger print scanner and additional colors ?  One thing is for sure i wasn’t a fan of the new IOS 7 design when it was originally announced but after using it for couple weeks on my old 4s i did fall in love of its clean lines which is something i can tweak with android thats the main selling point of the android os is that every little thing is customizable to the user.  I was mentioning to  a friend that i took the plunge and bought another Android Phone and he had very great analogy on the whole thing  it starts off as i mention that i bought new phone and re-learning the android way of doing things .. His clever response “Oh no, the dark side. heh”  Then i told him i had kept my 4s while i try out this phone for the next couple days if i still didn’t like it i could always return it back and just pay the restocking fee. I felt that the new iphone5s wasn’t any different it just felt like they tossed new coat of paint and called it a day. While he followed up with this
“Its smooth as butter though.iPhone is like a porsche and Android is like a pagani zonda.”  which was a cleaver analogy cause it made me remember this discussion on Top Gear and Jeremy rants on about how Porche hasn’t really done anything similar to how apple hasn’t done much with the Iphone. 

So i’m on full day 1 with this phone after few dozen downloads from the Play Store and few tweaks i think i’m finally getting use to this beast lets see if i can detox away from APPLE and IOS completely .

I’m including screenshot of my phone’s dashboard organized similar to my 4s

Screenshot_2013-10-03-17-38-36

 

“Running Nova Launcher and Prime”

01 Oct

Life Pro Tip :Create a bootable SD card for your Mac for emergencies and as a portable Mac when you’re away from yours

Modern Macs allow you to boot off of external drives be it USB, Thunderbolt or an SD card. What’s really great is that you can keep your SD card in your wallet or just about anywhere on you. Plus, SD cards are cheap and pretty resistant to physical conditions so fairly reliable compared to external HDDs.

KjdLETR

  1. Buy a class 10 or faster SD card. Use 32gb or larger.
  2. Format it to use a GUID partition scheme
  3. Use Carbon Copy Cloner to create a bootable copy of your current startup volume
  4. Hold down the “Option” key upon power up and select your SD card

If this is bit to Technical for you here’s link to youtube video that explains the process but in this case your using an SD Card for it
http://www.youtube.com/watch?v=BeVcHpzVjFw

Reasons to do this at all for non-techie types

 

Security: When you use a computer not yours, you are subjecting your entire computing experience to being recorded. Without spending a lot of time and having the appropriate access on the computer, you have no idea if malware like key loggers, screen capture, or cameras are enabled. With your own boot drive, the machine you boot off of becomes YOUR machine.

 

Recovery: If your Mac’s startup disk fails, it’s difficult (at worst) and time consuming (at best) to recover (if at all). Even if your data is stored on another disk, it would be time consuming to re-install and reconfigure all of your apps and their associated settings. Not all of your settings are backed up online like iCloud does with your iOS device.

 

Repair: If the primary boot drive of your mac fails, it’s possible to fix your boot drive. However, you’d have to boot into another another volume to do so. You could use a recovery disc but it’ll only have the most basic tools and take a long time. With a bootable read/write volume, not only can you repair your original startup but you can even use your portable boot volume for day to day work in the interim unlike the repair disc. For laptop owners, you won’t have to keep your optical drive with you everywhere. You can duct tape an SD card to your laptop if you need to.. or just leave it in.