Feed on
Posts
Comments

Ok, so I haven’t written in a while. I did a stint with a military contractor and made a robot. I’ve been busy! This, however, demanded just a lick of attention. The Secret of Invisibility.  Are you f***ing kidding me internet? Really? Really? Cause I thought we tried to avoid stuff that is so clearly bull. Guess not.

Heck, I almost feel bad for sending them the traffic.

The total yahoo selling this bunk can be reached at:

W. Williams, Bill
PO Box 513
Rumney, NH 03266

Or, over the phone 603-786-0000 (it looks like a fake number, but its what he has listed.)

Legal: I in no way suport the product featured at http://www.thesecretofinvisibility.com/. In fact, I think its unbelievable that they try to sell such utter s**t.

DIY Military Keyboard!

p1030548Recently, I came across a very cool Military Keyboard on ebay. After making an offer and getting one in the mail, I discovered that it had an interesting connector on it. So, naturally, I began the process of converting the keyboard from whatever connector it had on there, to USB. 

Continue Reading »

Edit: This code has an updated version, here!

This simple C program lists all of the “up” network interfaces on a linux system, along with their IP address and MAC address.

It prints off the bound IP address as well as the MAC address of the interface. A older version of this program can be found at http://www.doctort.org/adam/. The updates made to this version are IPv6 compatability and a fix of the “segfault” bug that was a problem in the first version. This version should compile and run on any linux system.

/*
 * Updated code to obtain IP and MAC address for all "up" network
 * interfaces on a linux system. Now IPv6 friendly and updated to use
 * inet_ntop instead of the deprecated inet_ntoa function. This version
 * should not seg fault on newer linux systems
 * Authors: Adam Pierce, Adam Risi
 * Date: 2/17/2009
 * http://www.adamrisi.com
 * http://www.doctort.org/adam/
 *
 * Previous file header follows:
 *
 * Example code to obtain IP and MAC for all available interfaces on
 * Linux.
 * by Adam Pierce 
 * http://www.doctort.org/adam/
*/
 
#include 
#include 
#include 
#include 
#include 
 
/*
 * this is straight from beej's network tutorial. It is a nice wrapper
 * for inet_ntop and helpes to make the program IPv6 ready
 */
char *get_ip_str(const struct sockaddr *sa, char *s, size_t maxlen)
{
  switch(sa->sa_family) {
  case AF_INET:
    inet_ntop(AF_INET, &(((struct sockaddr_in *)sa)->sin_addr),
	      s, maxlen);
    break;
 
  case AF_INET6:
    inet_ntop(AF_INET6, &(((struct sockaddr_in6 *)sa)->sin6_addr),
	      s, maxlen);
    break;
 
  default:
    strncpy(s, "Unknown AF", maxlen);
    return NULL;
  }
 
  return s;
}
 
int main(void)
{
  char          buf[1024] = {0};
  struct ifconf ifc = {0};
  struct ifreq *ifr = NULL;
  int           sck = 0;
  int           nInterfaces = 0;
  int           i = 0;
 
  /* Get a socket handle. */
  sck = socket(AF_INET, SOCK_DGRAM, 0);
  if(sck < 0) {
    perror("socket");
    return 1;
  }
 
  /* Query available interfaces. */
  ifc.ifc_len = sizeof(buf);
  ifc.ifc_buf = buf;
  if(ioctl(sck, SIOCGIFCONF, &ifc) < 0) {
    perror("ioctl(SIOCGIFCONF)");
    return 1;
  }
 
  /* Iterate through the list of interfaces. */
  ifr = ifc.ifc_req;
  nInterfaces = ifc.ifc_len / sizeof(struct ifreq);
  for(i = 0; i < nInterfaces; i++)
    {
      struct ifreq *item = &ifr[i];
 
      /* Show the device name and IP address */
      struct sockaddr *addr = &(item->ifr_addr);
      char ip[INET6_ADDRSTRLEN];
      printf("%s: IP %s",
	     item->ifr_name,
	     get_ip_str(addr, ip, INET6_ADDRSTRLEN));
 
      /* Get the MAC address */
      if(ioctl(sck, SIOCGIFHWADDR, item) < 0) {
	perror("ioctl(SIOCGIFHWADDR)");
	return 1;
      }
 
      /* display result */
      printf(", MAC %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
	     (unsigned char)item->ifr_hwaddr.sa_data[0],
	     (unsigned char)item->ifr_hwaddr.sa_data[1],
	     (unsigned char)item->ifr_hwaddr.sa_data[2],
	     (unsigned char)item->ifr_hwaddr.sa_data[3],
	     (unsigned char)item->ifr_hwaddr.sa_data[4],
	     (unsigned char)item->ifr_hwaddr.sa_data[5]);
 
    }
 
  return 0;
}

This code can be compiled by running:

$ gcc -o ifenum ifenum.c

Enjoy!

Everyone out there knows that emacs is the superior editor, right? Good! Now – you might have been programming recently and wished emacs was a little more frendy. GUI based editors have tabs, nice programming and documentation features, and little gems like autocompletion. Why, oh why doesn’t emacs have all this? Oh, it does!

  • Doxymacs – this package for emacs supports auto inserting comments for C and C++ code (at the beginning of files and before functions). Works great and makes your code beautiful!
  • M-/  - its not even a package! This little key-combo will autocomplete words based on the current open buffers. It does a great job on those lengthy variable names.
  • tabbar mode – Ever wished you could view your xemacs buffer list as tabs? Viola!

Those are just some of the great features emacs boasts. Whats your favorite?

So, you noticed that there is someone out there doing something nasty to your computer. Block their IP! Pulled directly from my .bashrc, I give you the most useful alias I have ever written:

alias blockip='sudo iptables -A INPUT -j DROP -s '
alias blockmac='sudo iptables -A INPUT -m mac -j DROP --mac-source '

Also included there is the ability to block a MAC address, just in case the attacker changes their IP. If you add those lines to your .bashrc, then blocking an IP/MAC is as easy as

$ blockip 1.2.3.4
$ blockmac 01:02:03:04:05:06

Just a last note, this only blocks incoming packets, not outgoing. Generally, this should be good enough to stop an attacker. Enjoy!

Worst. Name. Ever.

Todays post is short – but oh so sweet. Rember the marketing mistake named the “Chevy Nova”? Well, following in Chevys path of terrible names for mediocre products comes an MP3 player that, well, takes the cake. Without further ado - 

The TrekStor i.Beat Blaxx (“I beat blacks”)

They shortly after releasing the player renamed it, but you can still get a hint of the year-old fiasco from gizmodo.

To: Cygnus

Subject: Patent rights

Hey Cygnus! I recently was made aware of your patent infringement case against Google, Microsoft, and Apple concerning the use of “file preview technology.” While I am happy to see that you are ready to play in the big leagues, I have some terrible news for you:

You’ve already lost.

Google, Microsoft, and Apple were not even close to the first entities to employ icon-based previewing of files. A little look back in time, and you will find that the idea has been around since the unix days. There are open source implementations, it is a feature in most operating systems, and even shows up in on-line applications in file browsing or upload tools. Due to the fact that this technique has been around since, say, before 2001 (when you applied for a patent), I would hazard a guess that you getting a patent on the idea was a faux-pas by a patent clerk. 

Hey, even if it was a mistake, it was approved, right? Can you win? No, you can’t. Cygnus, you lost for one simple reason – money. Apple, Google, and Microsoft are technology giants with the resources to make you dissappear. Now, they may choose to do that with a quiet pay-off to keep this out of court, but asking for royalties? Forget it. Here’s a rule – If an idea was implemented in open source code prior to being patented, you are out of luck.

Besides, I’m certainly not going to remove any features from my precious linux distro. So there.

Your friend,

Adam Risi

Articles:

Hey all:

So, I am a little embarrassed to admit that this is my second python program, but happy to say that it works well, and is quite readable. Just thought I would share a simple quicksort in python:

def getFunc(array, x, func):
    ret = []
    for num in array:
        if func(num, x):
            ret.append(num)
    return ret
 
lessThan = lambda x, y: x < y
greaterThan = lambda x, y: x > y
equal = lambda x, y: x == y
 
def quicksort(array):
    if(array == []):
        return []
    elif(len(array) == 1):
        return array
    else:
        return quicksort(getFunc(array, array[0], lessThan)) + \
            getFunc(array, array[0], equal) + \
            quicksort(getFunc(array, array[0], greaterThan))
 
array = [5, 4, 5, 6, 8, 3, 2, 1, 6]
print(quicksort(array))
 
# OUTPUT
#
# $ python quicksort.py
#   [1, 2, 3, 4, 5, 5, 6, 6, 8]

Now, this code certainly is not as short as “Ahot’s blog”‘s version, but hey, I like it!

Oh, and on a side note, this is my first posting using GeSHi, and it works great!

Review of CountyComm.com

Grappeling Hook!It is my pleasure today to write a review of CountyComm, a government products group that develops devices for the US military as well as operates an online store. At CountyCom.com, anyone can find items ranging from a “space blanket” ($1.80) to custom devices like a collapsing grappling hook(~$25), a number of great bags, and some rare watches. With all this, its easy to see that they are a fun place to shop, but what makes them great?

CountyComm features one thing that most online retailers do not, originality. Most of the products that are for sale there are completely unique to CountyComm, and can not be found anywhere else. One of my personal favorites is their SO-LED (Special Operations LED). At only $2.00, you get a small, durable, stylish LED with a clip and a REAL on/off switch. For anyone out there that has gotten frustrated at little key-ring LEDs that need to be pressed to stay on, this is a great solution. 

I have only ordered from them once, but they were great – speedy, polite, and accurate. Admittedly, their store front does need a little work, but if you can get past their appearance online, they are an incredible place to shop. Highly Recommended!

Wow! It’s been a long road to get here, but I am happy to announce that picodns, the dns server that is part of “torus” (my peer to peer program in development) is finally in alpha. Anyone can download and use it, however they want! So, what is it?

Picodns is the DNS server that operates as part of “torus” – however, in its current implementation (revision 24) it is a fully functional alpha. I would not recommed it to anyone trying to run a perminent DNS server – yet. Picodns allows serving of A, AAAA, and MX records. It still requires memory patches, more of the DNS RFC to be implemented, and more, but as of current, it works.

Picodns has the “pico” prefix for a very good reason. At under 1500 (approx.) lines, it is a very small dns server that uses a very simple configuration file setup. Written with glib and libconfuse, it is easy to use, and the requirements for compilation are not too large. The whole server (not stripped) compiles to just 80K!

If you would like to try picodns, go ahead and download a copy of the current source by checking it out of the svn:

svn co http://torusp2p.com/svn/trunk/src/dns ./picodns

Remember, the current revision is 24 - later revisions most likely will change in structure and functionality. Documentation on picodns is still in its “baby” stage, so please be patient. If you like it, or would like some features added, leave a message!

« Newer Posts - Older Posts »