wk notes list find blog view edit

Notes



Change the keyboard layout on X
$ setxkbmap -layout es -model pc105 -rules xorg


SigAtomicT: As the C standar say:


- All variables accessed by signal handlers must be of type "volatile sig_atomic_t". Check this commit

Qemu tcp redirections
qemu -redir tcp:3389::3389 -redir tcp:5023::23 xp.img


Tracing function calls from GCC
// compile with:
// $ gcc -finstrument-functions test.c
#include <stdio.h>

void __cyg_profile_func_enter (void *this_fn, void *call_site)
__attribute__((no_instrument_function));

void __cyg_profile_func_enter (void *this_fn, void *call_site) {
printf ("--> call %p (%p)\n", this_fn, call_site);
}

//void __cyg_profile_func_exit (void *this_fn, void *call_site);
main() {
printf ("Hello World\n");
}



Oneliner IDC script for dumping the original file from the IDB (original file recovery):

auto i;auto fd;fd = fopen("d:\miau","w"); for(i=MinEA();i<MaxEA();i++) fputc(Byte(i),fd); fclose(fd);


GDB Commands


$ gdb --write -nx -q blah
(gdb) set {int} 0x804848 = 0x8484894
(WRITE-ON-DISK)



To create Debian packages...use "checkinstall":

$ sudo checkinstall \
  --pkgname radare \
  --pkgversion=0.9beta \
  --pkglicense=GPL \
  --maintainer=pancake@youterm.com \
  --requires=libgtk2.0-0,libncurses5


ScratchBoxTips


echo 4096 > /proc/sys/vm/mmap_min_addr
sysctl -w vm.vdso_enabled=0



'f' utility for finding files in shell



#!/usr/bin/perl -w

sub resolve_file {
  my $f = shift; # file mask

  my @lin=();
  if ($f=~/\.$/) {
  @lin = split(/\n/, `find . | grep '$f'`);
  } else {
  @lin = split(/\n/, `find . | grep '$f\$'`);
  }
  for my $l (@lin) {
  print "$l\n";
  $f = $l;
  }
  return $f;
}

sub resolve_contents {
  my $c = shift; # contents
  my $f = shift; # file mask
  my @lin=();
  if ($f=~/\.$/) {
  @lin = split(/\n/, `find . | grep '$f'`);
  } else {
  @lin = split(/\n/, `find . | grep '$f\$'`);
  }
  for my $l (@lin) {
  my $foo = `grep -re '$c' $l`;
  if ($foo ne "") {
  print "$l:\n$foo";
  }
  $f = $l;
  }
  return $f;
}

if ($#ARGV == -1) {
  print "Usage: f [grep-content] [file-mask] ; search for contents\n";
  print " f [file-mask] ; search for files\n";
} elsif ($ARGV[1] ne "") {
  resolve_contents($ARGV[0], $ARGV[1]);
} else {
  resolve_file($ARGV[0]);
}




yeahlaunch!



(sleep 2 && yeahlaunch -fn 9x15 -step 4 -x 530 -fg "light steel blue" \
  Terminal "Eterm" \
  Canoe canoe \
  Mixer "Eterm -e aumix" \
  Elinks "Eterm -e elinks" \
  Epiphany epiphany \
  Claws claws-mail \
  Gaim "gaim" \
  Irc "Eterm -e irssi --connect=libers.irc-hispano.org" \
  Gimp "gimp" \
  Inkscape inkscape \
  Home canoe \
  xkill xkill\
  Halt xhalt ) &



Canmore




RedBoot> fconfig
Run script at boot: true
Boot script:
.. load -v -r -m disk -b 0x200000 hda2:bzImage
.. exec -b 0x200000 -l 0x300000 -c "console=ttyS0,115200 root=/dev/sda2 rw mem=e
xactmap memmap=640K@0 memmap=384M@1M ip=dhcp irqpoll"
Enter script, terminate with empty line
>> load -v -r -m disk -b 0x200000 hda2:bzImage
>> exec -b 0x200000 -l 0x300000 -c "console=ttyS0,115200 root=/dev/sda2 rw mem=e
xactmap memmap=640K@0 memmap=320M@1M ip=dhcp irqpoll"
>>
Boot script timeout (1000ms resolution): 2
Use BOOTP for network configuration: true
Default server IP address:
Console baud rate: 115200
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
Update RedBoot non-volatile configuration - continue (y/n)? y
... Unlock from 0xc1fc0000-0xc1fe0000: .
... Erase from 0xc1fc0000-0xc1fe0000: .
... Program from 0x03fe0000-0x04000000 at 0xc1fc0000: .
RedBoot>