The Geek Forum

  • May 16, 2024, 06:32:03 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

Due to the prolific nature of these forums, poster aggression is advised.

*

Recent Forum Posts

Shout Box

Members
  • Total Members: 4962
  • Latest: hvWeils
Stats
  • Total Posts: 129633
  • Total Topics: 7189
  • Online Today: 168
  • Online Ever: 1013
  • (January 12, 2023, 01:18:11 AM)

Author Topic: What's your best hack?  (Read 3530 times)

Demosthenes

  • Evil Ex-HN Moderator
  • Administrator
  • Hacker
  • *
  • Coolio Points: +567/-72
  • Offline Offline
  • Gender: Male
  • Posts: 9904
  • Just try me. See what happens.
    • View Profile
    • Zombo
What's your best hack?
« on: June 25, 2004, 04:01:45 PM »

Ivan had a thread over on HN like this ages ago.

My best hack lately involves a particular piece of software that I'm responsible for implementing on our clients' servers when they buy it.

This software (which isn't written by us, thank Pepe), is a pile of crap.  It's also totally, 100% without documentation of any kind.

The first time I did a scheduled install of this software for a client, I was two hours into the process when I ran into a nasty problem.  It wouldn't find any of the data it was supposed to be using for reporting.  I called the senior developer at the company that makes this piece of shit software and he told me, "yeah, all the data that it accesses must be in a common directory".

The main accounting product that we support that this piece of shit program is an add-on to sets up the data environment in subdirectories separated by module... so your Accounts Payable tables are all in a subfolder called "APDATA" and your Accounts Receivable tables are all in a subfolder called "ARDATA", and all of your Inventory Control tables are in a subfolder called "ICDATA", and so on.

This is something they could have told us BEFORE I was two hours into an install that I was already doing without the benefit of any documentation.  :roll:

Anyway, I just did another one.  This client apparently wasn't briefed on the requirements either, and I came to a screeching halt immediately and told them "all of your data needs to be moved into a common folder".

Which is more difficult than it sounds.  A zillion other things that depend on this data staying put need to be adjusted manually in order to accommodate this.

Well, it was out of the question for these guys.  And, the idiots that they were, they had purchased this stupid program from us without anything more than a demo of it, not even finding out what the requirements of it were and whether or not it would be feasible to implement it easily on their own server/network.

I came up with a workaround for them that's quite ingenious if I do say so myself.

I discovered that this program doesn't JUST have to reference a common folder... it can reference a DBC -- a database container -- that in turn references all of the individual tables.

So I wrote this particularly devious code to pull pathing data out of one of their default system tables and dump it into a DBC, which I will then point this stupid piece of shit application to.

Code: [Select]
SET DELETED ON

CREATE DATABASE xxData

lc_dir    = LOWER(SYS(5) + ADDBS(CURDIR()))

USE sycpath ALIAS a_sycpat SHARED
SCAN
   lc_string = [CREATE SQL VIEW ] + LOWER(ALLTRIM(tablid) + ALLTRIM(compid)) +;
               [ AS SELECT * FROM ] + ALLTRIM(cdosdbf) + ALLTRIM(tablid) + ;
               ALLTRIM(compid) + [.DBF]

   &lc_string.
ENDSCAN


I tested it in-house and it works.  Pretty L337.  :twisted:

Okay.  So what's your best hack?  Doesn't have to be computer-related.  It transcends even technology if it's done in the true spirit of hack.
Logged

Coolio Points: 89,000,998,776,554,211,222
Detta Puzzle Points: 45

Banning forum idiots since 2001

pbsaurus

  • Hacker
  • ****
  • Coolio Points: +354/-31
  • Offline Offline
  • Gender: Male
  • Posts: 9981
  • Everyone Loves The King Of The Sea
    • View Profile
    • http://www.myspace.com/flipperpete
What's your best hack?
« Reply #1 on: June 25, 2004, 04:26:46 PM »

I once hacked up a giant piece of beef.

xolik

  • King of the Geekery
  • Hacker
  • ****
  • Coolio Points: +541/-25
  • Offline Offline
  • Gender: Male
  • Posts: 5176
  • HAY GUYS
    • View Profile
What's your best hack?
« Reply #2 on: June 25, 2004, 05:08:18 PM »

Quote from: pbsaurus
I once hacked up a giant piece of beef.


I once hacked on a giant piece of beef.
Logged
Barium: What you do if CPR fails.

=-=-=-=-=-=-=-=-=-=-=
[The Fade^C Compound]
-=-=-=-=-=-=-=-=-=-=-

The_FOO

  • Hacker
  • ****
  • Coolio Points: +61/-3
  • Offline Offline
  • Gender: Male
  • Posts: 1815
  • irc.hyperion.org:6667 #hn
    • View Profile
    • http://www.hyperion.org
What's your best hack?
« Reply #3 on: June 25, 2004, 05:40:37 PM »

Quote from: xolik
I once hacked on a giant piece of beef.


*thinks*
*attempts to come up with a comment*
*pauses*
*gives up in defeat*
Logged
http://www.errorfm.com/efm.pls
More FOOlish than you'll ever be.

The_FOO

  • Hacker
  • ****
  • Coolio Points: +61/-3
  • Offline Offline
  • Gender: Male
  • Posts: 1815
  • irc.hyperion.org:6667 #hn
    • View Profile
    • http://www.hyperion.org
What's your best hack?
« Reply #4 on: June 25, 2004, 06:14:40 PM »

oh oh oh! I remembered a wicked stupid hack from the mists of time.

Back in late 94, maybe early 95 when I was doing the ISP thing with 3 friends from Uni, our upstream provider changed over to OSPF on the Cisco 2500's we were using and screwed up the static routes we were using. When do they decide to do this? That's right, Friday afternoon.

So we need a dual ethernet router STAT. And Halifax isn't a big enough town back then that you can pick one of those up just anywhere.

We've got a couple Slack boxes kicking around the office so we get the bright idea to install a second NIC in one and instant router. So far so good, it starts routing up a storm (this was all running on 512K Frame Relay worth of upstream bandwidth BTW). 15-20 minutes later the box barfs and dies.

We scratch our heads and figure we'll optimize the kernel and hope that works. Now this if I recall correctly this was a 486SLC/66 with 16MB of RAM. Kernel recompiles are not the quick 15-20 minute jobs they are these days. Nope, a recompile took a good 2-3 hours.

The recompile finishes and we reboot with the new stripped down/optimized kernel. A short time later, boom, box locks up solid again. Cursing and swearing ensue. Box is rebooted, box crashes.

Then I have the brilliant insight that we never stopped the routing while the kernel recompile was going. So:

cd /usr/src/linux
make  

Box is rock solid, while routing, for a good 2-3 hours. The compile stops and a short time later the box barfs.

So we just wrote a short script the endlessly compiled the kernel and the box was reasonably stable all weekend with only one crash I think.

Near as I can figure the amount of network traffic was just too much for the SLC and/or the ISA bus and keeping the CPU busy slowed everything down enough to keep it from barfing on the packets.
Logged
http://www.errorfm.com/efm.pls
More FOOlish than you'll ever be.

Demosthenes

  • Evil Ex-HN Moderator
  • Administrator
  • Hacker
  • *
  • Coolio Points: +567/-72
  • Offline Offline
  • Gender: Male
  • Posts: 9904
  • Just try me. See what happens.
    • View Profile
    • Zombo
What's your best hack?
« Reply #5 on: June 28, 2004, 09:44:17 AM »

That just made me LOL, Foo.  I'm gonna have to share that with a fellow Linux friend of mine that once tried something similar but had less success.  :)
Logged

Coolio Points: 89,000,998,776,554,211,222
Detta Puzzle Points: 45

Banning forum idiots since 2001

reimero

  • Hacker
  • ****
  • Coolio Points: +112/-5
  • Offline Offline
  • Posts: 1147
    • View Profile
    • http://www.omgjonx.com
What's your best hack?
« Reply #6 on: June 28, 2004, 10:16:18 AM »

Well, I'm not much of a programmer, but I did manage to hack a perlscript into adding checkboxes to a selection list.  :roll:

Lame, I know, but when you're as bad a programmer as I am, you take it where you can.
Logged
"This f*cker is in wisconsin, reimero is from awesomeland." - Bobert

gorgeous_si

  • Jail Bait
  • *
  • Coolio Points: +11/-0
  • Offline Offline
  • Posts: 188
    • View Profile
    • http://www.gorgeous-si.co.uk
What's your best hack?
« Reply #7 on: June 28, 2004, 10:43:26 AM »

A friend of mine linked me to an article recently about encryption. It had a section on factorising numbers (most modern encryption uses keys that are the product of two very large primes). So, one of the main tasks faced by decrypters is factorising numbers. We decided to see what we could come up with, and had a small matlab programming contest - a race to see who could come up with a program first, then we timed our code, optimized, raced again. We ended up combining our algorithms to produce this three line beauty:

Code: [Select]
possibleFactors = 1:(sqrt(number));
foundFactors = find(mod(number, possibleFactors)==0);
factorSet = [foundFactors; number./foundFactors]';

I just factorized 956564844779 (12 digits), in 0.4530 seconds!

I think this counts as a hack, because the second line relies on the fact that the array 'possibleFactors' contains the numbers 1 to the square root of the target number, it then 'finds' the location of all the numbers on the array that have a modulus of zero - and rather than working with the array values, just works using their locations within the array (since they are actually the same thing) ... this may not make much sense but it yielded huge speed reductions (in the order of 50-60%).
Logged

Demosthenes

  • Evil Ex-HN Moderator
  • Administrator
  • Hacker
  • *
  • Coolio Points: +567/-72
  • Offline Offline
  • Gender: Male
  • Posts: 9904
  • Just try me. See what happens.
    • View Profile
    • Zombo
What's your best hack?
« Reply #8 on: June 28, 2004, 11:07:07 AM »

reimero, for a non programmer to be monkeying around with perl, and actually getting positive results, that most CERTAINLY counts.  

Quote from: gorgeous_si
A friend of mine linked me to an article recently about encryption. It had a section on factorising numbers (most modern encryption uses keys that are the product of two very large primes). So, one of the main tasks faced by decrypters is factorising numbers. We decided to see what we could come up with, and had a small matlab programming contest - a race to see who could come up with a program first, then we timed our code, optimized, raced again. We ended up combining our algorithms to produce this three line beauty:

Code: [Select]
possibleFactors = 1:(sqrt(number));
foundFactors = find(mod(number, possibleFactors)==0);
factorSet = [foundFactors; number./foundFactors]';

I just factorized 956564844779 (12 digits), in 0.4530 seconds!

I think this counts as a hack, because the second line relies on the fact that the array 'possibleFactors' contains the numbers 1 to the square root of the target number, it then 'finds' the location of all the numbers on the array that have a modulus of zero - and rather than working with the array values, just works using their locations within the array (since they are actually the same thing) ... this may not make much sense but it yielded huge speed reductions (in the order of 50-60%).


Whoa... nice work!  That definitely counts!  Now try it with a 30-digit number.  8)
Logged

Coolio Points: 89,000,998,776,554,211,222
Detta Puzzle Points: 45

Banning forum idiots since 2001

reimero

  • Hacker
  • ****
  • Coolio Points: +112/-5
  • Offline Offline
  • Posts: 1147
    • View Profile
    • http://www.omgjonx.com
What's your best hack?
« Reply #9 on: June 28, 2004, 11:11:57 AM »

Quote from: Demosthenes
reimero, for a non programmer to be monkeying around with perl, and actually getting positive results, that most CERTAINLY counts.  


Thanks, Demo!  In all fairness, I had a tiny bit of help from someone who knows perl (but it really only involved a single replace function, the rest really was me.)  The kicker is that other people are using my hacked script now.
Logged
"This f*cker is in wisconsin, reimero is from awesomeland." - Bobert

Demosthenes

  • Evil Ex-HN Moderator
  • Administrator
  • Hacker
  • *
  • Coolio Points: +567/-72
  • Offline Offline
  • Gender: Male
  • Posts: 9904
  • Just try me. See what happens.
    • View Profile
    • Zombo
What's your best hack?
« Reply #10 on: June 28, 2004, 11:15:06 AM »

Quote from: reimero
The kicker is that other people are using my hacked script now.


Hey, that's usually the best compliment a code-monkey can get!  8)
Logged

Coolio Points: 89,000,998,776,554,211,222
Detta Puzzle Points: 45

Banning forum idiots since 2001

phyre

  • My Space Emo Attention Whore
  • **
  • Coolio Points: +14/-1
  • Offline Offline
  • Gender: Male
  • Posts: 431
    • View Profile
    • http://morningphyre.com
What's your best hack?
« Reply #11 on: June 28, 2004, 01:30:11 PM »

I don't know if this counts. Personally, I don't think so, because no actual code was involved, and any schoolchild could have done it- but because I did it, and no one else did, and due to the success of the venture, I'll tell the tale.

   I used to work for Alltel, a cell phone/telecom company. While working there, I used an AS/400 emulator software called CBIS (Chicago Business Informaiton Solutions, I think). Anyway, after working there a while, I started messing around in CBIS to see what I could do with it- turns out there was a macro function that was pretty stocked- basically you record a macro, open the editor, and there was a toolbox to add and remove commands. At first, it was simple macros to take over minor functions and repetitive tasks I had to do all the time- later I started messing with more commands and was able to build prompts in, pauses for specific times, and I was even able to make a macro wait until the screen changed before prompting for info.

   By the time I was done, I had a total of 30 macros built to handle tasks- about 7 of which were for regular use. The best part is, the company didn't know anything about this, and I was able to work pretty much under the radar on it. I also distributed the macros (they were stored as .rmc files) to other users who loved them- I had 18 other users working with them before the company upgraded and killed the old system. However, I kept a backup copy and distributed it to the shipping office there- for all I know, they're still using it over a year and a half later.

   It was one of the most fun projects I ever worked on- unfortunately, it's platform-based, so it wouldn't carry over when they upgraded, and the macro function on the new system wasn't nearly as powerful. I wish I could find a macro editor like that that wasn't platform based- it'd be nice to be able to automate functions on my own machine outside of a specific program.
Logged


"Together we are what we can't be alone" -Dropkick Murphys

The_FOO

  • Hacker
  • ****
  • Coolio Points: +61/-3
  • Offline Offline
  • Gender: Male
  • Posts: 1815
  • irc.hyperion.org:6667 #hn
    • View Profile
    • http://www.hyperion.org
What's your best hack?
« Reply #12 on: June 29, 2004, 01:43:39 PM »

Quote from: reimero
Quote from: Demosthenes
reimero, for a non programmer to be monkeying around with perl, and actually getting positive results, that most CERTAINLY counts.  


Thanks, Demo!  In all fairness, I had a tiny bit of help from someone who knows perl (but it really only involved a single replace function, the rest really was me.)  The kicker is that other people are using my hacked script now.


I agree. I've been working with PERL for years now and it still hurts my brain.
Logged
http://www.errorfm.com/efm.pls
More FOOlish than you'll ever be.

The_FOO

  • Hacker
  • ****
  • Coolio Points: +61/-3
  • Offline Offline
  • Gender: Male
  • Posts: 1815
  • irc.hyperion.org:6667 #hn
    • View Profile
    • http://www.hyperion.org
What's your best hack?
« Reply #13 on: June 29, 2004, 01:49:29 PM »

Quote from: Demosthenes
That just made me LOL, Foo.  I'm gonna have to share that with a fellow Linux friend of mine that once tried something similar but had less success.  :)


Glad it was a source of amusment. At the time we didn't find it so funny, but a few weeks later it was starting to become humourous.

Then there was the time one of the support guys did the kill -9 -1 in a root shell on the Auth server by accident.  Made even funnier cause we were hanging out in the local IRC channel and a friend of ours came in and said "boogabooga" about the same time.

Why is that funny? Cause it was the root password at the time. We all thought we'd be hacked.
Logged
http://www.errorfm.com/efm.pls
More FOOlish than you'll ever be.

Demosthenes

  • Evil Ex-HN Moderator
  • Administrator
  • Hacker
  • *
  • Coolio Points: +567/-72
  • Offline Offline
  • Gender: Male
  • Posts: 9904
  • Just try me. See what happens.
    • View Profile
    • Zombo
What's your best hack?
« Reply #14 on: June 29, 2004, 04:49:44 PM »

LOL!  That's great!  :lol:
Logged

Coolio Points: 89,000,998,776,554,211,222
Detta Puzzle Points: 45

Banning forum idiots since 2001