Difference between revisions of "Random Stuff"

From WTFwiki
Jump to navigation Jump to search
m (25 revisions)
 
(9 intermediate revisions by 3 users not shown)
Line 20: Line 20:
  
 
* [http://predef.sourceforge.net/preos.html List of Operating System Defines] - Handy for doing OS checking in the C preprocessor.
 
* [http://predef.sourceforge.net/preos.html List of Operating System Defines] - Handy for doing OS checking in the C preprocessor.
 +
 +
How to list the architecture specific preprocessor defines in gcc:
 +
  echo | gcc -E -dM -
 +
 +
Taken from [http://wahjava.wordpress.com/2006/07/18/gcc-architecture-specific-preprocessor-defines/ here].
  
 
* [[Reverse engineering DOS binaries]]
 
* [[Reverse engineering DOS binaries]]
Line 27: Line 32:
 
* [http://www.pement.org/awk/awk1line.txt awk one liners]
 
* [http://www.pement.org/awk/awk1line.txt awk one liners]
 
* [http://student.northpark.edu/pemente/sed/sed1line.txt sed one liners]
 
* [http://student.northpark.edu/pemente/sed/sed1line.txt sed one liners]
 +
 +
* [http://www.ibm.com/developerworks/aix/library/au-satbash.html BASH tips and tricks]
 +
 +
* [http://www.howtoforge.com/linux_resizing_ext3_partitions_p2 How to resize ext3 partitions with fdisk/resize2fs]
 +
 +
* [http://erlang.org/pipermail/erlang-questions/2009-April/043460.html Erlang HIPE bitarrays] - Undocumented mutable bitarrays/binaries for Erlang (when using HIPE)
 +
== OpenBSD key life times in ipsec.conf ==
 +
Use the undocumented 'life' keyword for quick and main mode [http://kerneltrap.org/mailarchive/openbsd-misc/2007/12/7/481748 see here].
 +
'''NOTE''': This has been found to not exactly work as (not) advertised.. ymmv.
 +
 +
== Subnet calculations ==
 +
I always forget how to do these.
 +
 +
The Broadcast Address is obtained doing a binary OR between an address in the subnet and the inverted Subnet Mask. You can invert the subnet mask by XORing it with the decimal representation of 255.255.255.255.
 +
 +
The Subnet Address is obtained by doing a binary AND between an address in the subnet and its Subnet mask.
 +
 +
A handy tool to convert address to/from decimal can be found [http://www.countryipblocks.net/tools/ip-octet-binary-and-decimal-calculators/ here]
 +
 +
See Also: [http://en.wikipedia.org/wiki/Ipv4_subnetting_reference Wikipedia IPv4 subnetting reference]

Latest revision as of 21:48, 4 January 2013


To convert asterisk gsm files to wav files it can still play:

 sox tt-weasels.gsm -r 8000 -b -c 1 -u -2 tt-weasels.wav

Upgrading pkgsrc bootstrapped packages (bmake install-sh nawk nbsed pax tnftp bootstrap-mk-files):

bmake USE_DESTDIR=full package
rm /var/db/pkg/<pkgname>-<pkgversion>/+PRESERVE
pkg_delete "<pkgname>*"
pkg_add /usr/pkgsrc/packages/All/<pkgname>-<pkgversion>.tgz
touch /var/db/pkg/<pkgname>-<pkgversion>/+PRESERVE

How to list the architecture specific preprocessor defines in gcc:

 echo | gcc -E -dM -

Taken from here.

OpenBSD key life times in ipsec.conf

Use the undocumented 'life' keyword for quick and main mode see here. NOTE: This has been found to not exactly work as (not) advertised.. ymmv.

Subnet calculations

I always forget how to do these.

The Broadcast Address is obtained doing a binary OR between an address in the subnet and the inverted Subnet Mask. You can invert the subnet mask by XORing it with the decimal representation of 255.255.255.255.

The Subnet Address is obtained by doing a binary AND between an address in the subnet and its Subnet mask.

A handy tool to convert address to/from decimal can be found here

See Also: Wikipedia IPv4 subnetting reference