Interesting use of Twitter


I've been a Twitter user for over year now and I still don't really understand it. Twitter seems like a great way to IM a group of people, and that is about all. Now I admit that I don't really get into it, and only once did I receive an answer to a question through Twitter. Otherwise it really just seems to me to be about self-aggrandizement. I'm not saying that is bad though, just making an observation.

That opinion changed a little bit recently. Last week I received an email from a job recruiter. (If any of my co-workers who actually read this want to know, I turned the job opportunity down.) However there was something out of the ordinary that caught my eye:

“For up to date Vivo job openings and other 'hopefully helpful' info
Please follow me at www.twitter.com/johnzinkvivo"

I followed the link and saw that what John is doing is putting up quick blurbs of job titles on Twitter, in addition to his other random tweets. And this struck me as a great way to use this medium. In fact I think this idea is such a good one that with proper the proper usage of hashtags and enough recruiters doing it, we could see an evolution in the online job hunting arena. There is less of a need to rely strictly on Dice, Monster, Cyber Coders, and if I dare say it, even Craigslist, when you could just post on Twitter. It's basically the same idea. With Dice and all, you post a job, and wait for the responses to come it. With Twitter you can do the same thing, post a tweet with a link for the job on your site, and wait.

It's not a perfect idea, and would probably need some form of filtering to make it worthwhile. But I do think that in time this evolution will happen. It makes sense to me. In the meantime, I am just happy that I have found for myself a “good” use of Twitter.

Pop Quiz: Spot the Bug, CRON Edition

That's right boys & girls, its quiz time. Get out your brains and prepare to use them.

The file below is a standard cronjob file, hiding in /etc/cron.d. Can anyone point out to me what the bug is? Assume that some_script exists and produces output. And yes there is a bug in there. I promise.

  1. 55 14 * * * root sleep $(($RANDOM % 60)); logger -p local3.info "some script"; OUT=`/opt/sbin/some_script 2>&1` ; logger -p local3.info $OUT;

Unless someone posts a comment with the correct answer( and earns themselves a virtual beer), I will share the answer next week.

PXE Network Boot VirtualBox, PT 2

I have a project for work that involves setting up Debian's Fully Automated Install (FAI) for a new server type that the company plans to roll out. The server is a 4U chassis, which holds 36 hard drives in it. And I am in charge of seeing if we can use a small 8 GB SSD for  the root partition. I've been figuring out FAI for the past couple of nights, but today my hardware disappeared. So until it returns - its off on a quest at the moment -  I figured I would try and to use VirtualBox to continue testing.
 
I started by creating a new machine in VirtualBox, 8GB drive, 1024 MB of RAM, and that is when I realized I didn't have the foggiest idea how to get VirtualBox to PXE boot. So off to the interwebs I went, searching for an answer. And in my travels I came across a (A new one will probably work better)

Click on the setting for your virtual machine you wish to PXE boot with.
Select the “Network” tab. It give you a picture like this:

Now click on the “Attachted To:” button and move it down to “Bridged Adapter”. Like so:


 And finally,  (if it isn't already set up correctly for you), select “Name” to be your working network card.
 
Again, credit for the initial write up go to Noah Seidman whose initial blog post got me going. You write a lot of good technical articles Noah, keep up the good work! I just wanted to explicitly state how to get this last part of your tutorial working in case someone did not know how to do it themselves.

Interview question: Recreate groups PART 2

In a previous post you might have noticed that I wrote some code that was incomplete. (Thanks Dave for pointing that out! Greatly Appreciated!) And now that some time has passed, and my life has calmed down enough to give this another shot, here is my new version of the code.

You might notice that a lot has changed since the last version. Most importantly, I got rid of going the a shell out, as it has been taught to me that there are security concerns with doing so. You should also notice that I'm using regex's to do the filtering, I'm sure these could be tightened down a little bit. But I won't get better with them unless I at least start using them. I'm also getting the default group id of the user, and returning that first in the output. And finally, I am doing some error checking to make sure that the account is actually in the system; something my previous script did not check for.

All in all, I'm happier with this script than the first version. And of course, I'm interested in seeing if anyone can find out other bugs that exist inside the code.

  1. #!/usr/bin/perl
  2. #######################################################################
  3. # Created By: Bryce Verdier
  4. # on 1/19/10
  5. # modified to fix errors 3/12/2010
  6. # Function: rework the output of the unix groups command
  7. # NOTE: FOR USE ON UNIX MACHINES!
  8. #######################################################################
  9.  
  10. use warnings;
  11. use strict;
  12. use Getopt::Std;
  13.  
  14. sub get_gid
  15. {
  16. my ($name) = @_;
  17.  
  18. return getgrnam($name);
  19. }
  20.  
  21. sub open_and_parse
  22. {
  23. my ($in_user, $in_gid) = @_;
  24. my $guid_name;
  25. my @split;
  26. my @parse_groups;
  27. my @end_array;
  28.  
  29.  
  30. open(PASSWD, "/etc/group");
  31. while(<PASSWD>){
  32.  
  33. # This line is to grab the default in_gid name
  34. if ( $_ =~ m/^.*\:$in_gid\:\:*/ ){
  35. @split = split(':', $_);
  36. $guid_name = $split[0];
  37. }
  38.  
  39. # This line is to grab any line which has the in_user in it
  40. # while also rejecting the line with the in_gid number in it
  41. elsif ( $_ =~ m/^.*$in_user.*/ ){
  42. @split = split(':', $_);
  43. next if ( $split[2] == $in_gid );
  44. push (@parse_groups, $split[0]);
  45. }
  46.  
  47. # we don't care about anything else so skip it
  48. else{
  49. next;
  50. }
  51. }
  52.  
  53. push ( @end_array, $guid_name);
  54. push ( @end_array, @parse_groups);
  55.  
  56. return @end_array;
  57. }
  58.  
  59.  
  60. ## Main script starts here
  61. our($opt_u);
  62. getopts('u:');
  63.  
  64. my $gid = get_gid($opt_u);
  65.  
  66. if ( defined($gid) ) {
  67. my @groups = open_and_parse($opt_u, $gid);
  68. print "$opt_u : @groups\n";
  69. }else{
  70. print "$0: $opt_u: No such user\n";
  71. }
  72.  
  73. exit 0;

Syndicate content