Updates from December, 2014 Toggle Comment Threads | Keyboard Shortcuts

  • ThomasPowell 3:21 pm on December 9, 2014 Permalink  

    The story behind rspec kung fu hamster 

    rspec-kungfuhamster originated as a joke on a POS development team I worked on almost 10 years ago. In the battle of scope creep and requirements changes, we all got a bit loopy and a couple members of the team drew up an ASCII animated “kung fu hamster” as a terminal-based spinner while the credit card authorization (often by modem) was taking place.

    Strangely, product ownership didn’t see the humor in so much time being spent on the animation.

    I decided to revive kung fu hamster as an rspec formatter in honor of those days of solving technical problems on out-of-date SCO Unix boxes without access to anything but standard and home grown libraries, as well as the two team members that have passed away at far too young an age since.

     

     
  • tech0x20 8:45 am on September 3, 2011 Permalink | Reply
    Tags: novice   

    This kid knew enough to be dangerous. 

    Running this old code, which was probably not actually turned in for anything, through the gcc compiler alone showed that there was a glaring error that would have been exposed on the the first run.

    Beyond the initial compiler warnings, there are the ALL CAPS variables, the while loops used as pure for loops…

    #include "stdio.h"
    main()
    {
    
        int rows,columns,ROW, COLUMN;
        scanf("%d %d",ROW,COLUMN);
        rows = 0;
        columns = 0;
        while(columns++ < COLUMN)
            printf("xdb");
        printf("n");
        rows += 1;
        while(rows++ < (ROW - 2)){
            columns = 0;
            printf("xdb");
            while(columns++ < (COLUMN - 2)){
                printf(" ");
                }
            printf("xdbn");
            }
        columns = 0;
        while(columns++ < COLUMN) {
            printf("xdb");
            }
    
    
    }
    
     
  • tech0x20 8:23 am on July 18, 2008 Permalink | Reply  

    I miss C programming. Program to find prime numbers 

    Uses unsigned long long, goes up to ULONG_LONG_MAX.

    Intel Core Duo 2 processor, running Cygwin on Windows XP, and compiled using gcc 3.4.4. Stops at first million results due to time. Can reasonably get to 10 million, if you’re willing to wait.


    #include <stdio.h>
    #include <math.h>
    #include <limits.h>

    int main(int argc, char **argv)
    {
    unsigned long long divisor, max_divisor, prime_test;
    int break_time = 0;

    printf("%llun", 2LL);
    for(prime_test = 3LL; prime_test < ULONG_LONG_MAX; prime_test+=2LL)
    {
    max_divisor=1LL+sqrt(prime_test);
    for(divisor=3LL;divisor <= max_divisor; divisor+=2LL)
    {
    if(prime_test % divisor == 0)
    {
    break;
    }
    }
    if(divisor >= max_divisor)
    {
    printf("%llun", prime_test);
    }
    else
    {
    continue;
    }
    break_time++;
    if(break_time == 999999)
    {
    break;
    }
    }
    return 0;
    }
     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel
%d bloggers like this: