Welcome to theowned[d0t]org!

This site is meant to serve two purposes: 1) To collect and store various pieces of information or howto documentation I collect over time, and 2) To provide this information freely for anyone that requires it.

-foldingstock

lspci in *BSD

A common question newcomers to *BSD typically ask is "where is lspci?" The simple answer is: install pciutils.

http://mj.ucw.cz/pciutils.html

Ubuntu and TV Tuners

I have a Philips Semiconductors PCI TV Tuner card that I use to watch TV on the computer. Using this card in Ubuntu is a breeze.

lspci reports the following card:

00:0a.0 Multimedia controller: Philips Semiconductors SAA7131/SAA7133/SAA7135 Video Broadcast Decaoder (rev d0)

To use this card, all that is required is to load the drivers:

rmmod saa7134_alsa
rmmod saa7134
modprobe saa3134 card=81

Now load a TV Tuner program, such as "tvtime."

Rounding in C++

I was recently working on a C++ project that required a floating-point number to be converted to a static integer. Unfortunately, C++ does not offer a rounding function. When the floating-point number was converted to an integer, the decimal value was simply dropped.

C++ does offer floor() and ceil(), but I needed something that would accurately round. So, I wrote a simple function that uses floor():

---------------------------------------------
double round(double x)
{
return double(floor(x + 0.5));
}
---------------------------------------------

VI auto-indent

Edit ~/.exrc and add the following line:

set ai sw=4 wm=5 sm

* ai - This tells vi to use auto-indent for insertions.
* sw=4 - This tells vi to use 4 spaces for each level of indentation in auto-indent mode.
* wm=5 - This tells vi to wrap a line 5 spaces from the right margin.
* sm - This tells vi to show matching parentheses, brackets, and braces in insert mode. When you type a closing parenthesis, bracket, or brace the cursor will briefly jump to the matching parentesis, bracket or brace.

FreeBSD - EEE PC with working Wireless

To get wireless working under FreeBSD on Asus's EEE PC, you must first download the latest madwifi driver:

http://snapshots.madwifi-project.org/madwifi-hal-0.10.5.6/

Download the tarball and transport it to the EEE PC using removable media (USB drive, SD card, etc). Untar the tarball and then run:

# cd madwifi-hal-0.10.5.6-r3879-20081204/hal
# cp -R * /usr/src/sys/contrib/dev/ath/

Now recompile your kernel:

# cd /usr/src
# make buildkernel KERNCONF=GENERIC
# make installkernel KERNCONF=GENERIC

Flash9 running natively in FreeBSD 7.1

Yes, FreeBSD 7.1 has working Flash9 support. To install it on your system:

  • Add linux_enable="YES" to /etc/rc.conf.
  • Add compat.linux.osrelease=2.6.16 to /etc/sysctl.conf.
  • Add OVERRIDE_LINUX_BASE_PORT=f8 to /etc/make.conf.
  • Add this line to /etc/fstab:
    linproc /usr/compat/linux/proc linprocfs rw 0 0


Then run these commands:

# mkdir -p /usr/compat/linux/proc
# mount /usr/compat/linux/proc
# /etc/rc.d/abi start
# /etc/rc.d/sysctl start

Once you have done the above, your system is ready for the installation. Install the following ports:

Ettercap Filters

Below is a simple ettercap filter that I used to pull off a rather funny April fools joke at my school. Basically, the filter intercepts all "a href=" html links and replaces it with the string I specified, www internetisseriousbusiness org.(warning: don't visit that link unless you like annoying popups and rickrolls)

The code for the filter:

if (ip.proto == TCP && tcp.dst == 80) {
if (search(DATA.data, "Accept-Encoding")) {
replace("Accept-Encoding", "Accept-Rubbish!");
# note: replacement string is same length as original string
msg("zapped Accept-Encoding!\n");
}
}
if (ip.proto == TCP && tcp.src == 80) {
replace("<a href=", "<a href="internetisseriousbusiness.org" ");
replace("<A HREF=", "<a href="internetisseriousbusiness.org" ");
msg("Filter Ran.\n");
}

To actually use this, you will need to convert the code to a usable format.

Ubuntu - Quick Start

On a newly installed Ubuntu system I usually run the following to install basic tools needed for development and source compilation:

#apt-get install ssh openssh-server openssh-client

#apt-get install libx11-6 libx11-dev libxtst6 xlibs-dev xinetd wget

#apt-get install linux-headers-`uname -r` build-essential

#apt-get install gcc binutils-doc cpp-doc make manpages-dev autoconf automake1.9 libtool flex bison gdb gcc-doc gcc-4.0-doc libc6-dev-amd64 lib64gcc1

Perl - Case Combinations

A simple perl script that takes a word as a command-line argument and displays every possible case combination for that word:

------------------------------------------------------------------------------------
#!/usr/bin/perl
# foldingstock ^_^
use warnings;
use strict;

print "$_\n" for glob join '', map"{\l$_,\u$_}", split //, "$ARGV[0]"
------------------------------------------------------------------------------------

Example:

> ./combination.pl test
test
tesT
teSt
teST
tEst
tEsT
tESt
tEST
Test
TesT
TeSt
TeST
TEst
TEsT
TESt

Syndicate content