2of1
half a nibble of another

Home
Projects
About
Jul

11

Simple C hashtable code

Filed Under (C, Coding, Open source) by 2of1 on 11-07-2011

Here’s some code for a simple C hashtable.
Read the rest of this entry »

(3) Comments
Read More
Jul

04

DC9723 – Exploiting LD_PRELOAD slides and code examples

Filed Under (C, Code injection, Coding, Compilers, DC9723, Hacking, Linux, Linux kernel, Open source, Reverse engineering, Social, Tips & tricks) by 2of1 on 04-07-2011

Here are the slides and code examples of the talk that I gave at the 7th DC9723 meet a few weeks ago.

To all those that came; thanks – I hope you found it interesting!

No Comments
Read More
May

03

Listing all available g++ compiler symbols

Filed Under (C, Coding, Linux, Tips & tricks) by 2of1 on 03-05-2011

cpp -dM /dev/null
No Comments
Read More
Mar

21

Cross-compiling x86 from x86_64

Filed Under (C, Coding, Compilers, Linux, Open source, Tips & tricks) by 2of1 on 21-03-2011

Here are two easy ways to compile 32-bit binaries on a 64-bit system.
Read the rest of this entry »

No Comments
Read More
Nov

23

Making sense of strcmp()

Filed Under (C, Coding, Open source) by 2of1 on 23-11-2010

Peter van der Linden brought up a point regarding strcmp() his book Expert C Programming: Deep C Secrets that I found interesting.
Read the rest of this entry »

(2) Comments
Read More
Sep

21

Writing to kernel ring buffer from userspace

Filed Under (C, Coding, Linux, Linux kernel, Open source) by 2of1 on 21-09-2010

UPDATE: See comments

Linux purists are going to go crazy at this, but I was looking for a way to write to the kernel ring buffer (read by dmesg) from a userspace script.
I’m not going to debate the ‘whys’ – but in short I like having my sys logs for automated system actions (some which are userspace-launched) in one neat place.
Read the rest of this entry »

(4) Comments
Read More
Aug

17

Random value with limits in C

Filed Under (C, Coding) by 2of1 on 17-08-2010

There’s a quick and effective way of producing a random value in C if you only require it at most once per second using current time as a random seed:

#include <time.h>     // time_t, time()
#include <stdlib.h>   // srand(), rand()
 
time_t s;
time(&s);
srand((unsigned int)s);
 
// calc random value (limits are inclusive)
int rand_val = 1 + (int)((float)UPPER_LIMIT * 
               (rand() / (RAND_MAX + (float)LOWER_LIMIT)));

Of course reading from /dev/urandom is good too :) (on linux).

(2) Comments
Read More
Jul

22

Direct2D headers for MinGW and mingw-w64

Filed Under (C, Coding, Compilers, Direct2D API, Open source) by 2of1 on 22-07-2010

I wrote some Direct2D compatibility headers to allow for cross-compilation using MingW or mingw-w64.
Read the rest of this entry »

No Comments
Read More
Jul

22

MinGW Direct2D headers – vftable issue

Filed Under (C, Coding, Compilers, Direct2D API, Open source) by 2of1 on 22-07-2010

A while back I wrote a tool to build Direct2D api headers off the public information on MSDN.

Yesterday I noticed that my vlc patch – while compiling fine – crashes on a certain D2D API call.

The reason for this it seems that my generation tool pulls off the API from MSDN in the order that it appears there – i.e. alphabetical order.
Read the rest of this entry »

(3) Comments
Read More
Jun

21

O_NONBLOCKing socket()s

Filed Under (C, Coding, Networking) by 2of1 on 21-06-2010

When connect()ing to a server, there is no direct way to define a timeout for that connection attempt – meaning that you could be waiting for a LONG time.

Read the rest of this entry »

No Comments
Read More
« Older Entries
  • Recent Posts

    • ARM long branch
    • Mini-Namco #3: (Almost) Finished
    • Mini-Namco #2: Unit construction
    • Mini-Namco #1: Design
    • Simple C hashtable code
  • Archives

    • January 2012
    • September 2011
    • August 2011
    • July 2011
    • May 2011
    • March 2011
    • February 2011
    • January 2011
    • November 2010
    • October 2010
    • September 2010
    • August 2010
    • July 2010
    • June 2010
  • GitHub

    • code
    • d2d1headers
    • locateme
    • findjerusalem
    • seg7
    • userspace-krb
    • libgmail
    • preloader
    • linhook
  • qrcode

  • Site Search

  • Categories

    • Apps (7)
      • Preloader (1)
      • Symbian S60 (1)
      • VLC (4)
      • Wordpress (1)
    • Coding (28)
      • Assembly (1)
        • ARM (1)
      • C (12)
      • Compilers (5)
      • Direct2D API (4)
      • Linux kernel (2)
      • Networking (4)
      • Python (1)
      • Sqlite (1)
      • Version control (5)
        • Git (5)
    • Hacking (4)
      • Code injection (1)
      • Reverse engineering (3)
    • Hardware (4)
      • Arduino (1)
      • PCBs (3)
    • Linux (21)
      • Bash (1)
      • Tips & tricks (13)
      • Virtualization (1)
      • VNC (2)
      • Xmonad (1)
    • Open source (30)
    • Other stuffs (3)
    • Social (3)
      • DC9723 (2)
  • OctoFinderProgramming Blogs - Blog Catalog Blog Directory

    Locations of visitors to this page

© 2of1.