Category: Computers

Making a SOCKS proxy transparent

By , 2010-07-07 15:43

Finally, after about an hour of googling, I found a program that allows a SOCKS proxy to be made transparent. Installed on a router/gateway, this can force all LAN users’ traffic through the proxy.

http://darkk.net.ru/redsocks/

via http://wiki.przemoc.net/tips/linux#making_socks_proxy_transparent

HOWTO: Easily modify dependencies of a .deb file – Ubuntu Forums

By , 2010-06-28 10:35
#!/bin/bash
 
if [[ -z "$1" ]]; then
  echo "Syntax: $0 debfile"
  exit 1
fi
 
DEBFILE="$1"
TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
OUTPUT=`basename "$DEBFILE" .deb`.modfied.deb
 
if [[ -e "$OUTPUT" ]]; then
  echo "$OUTPUT exists."
  rm -r "$TMPDIR"
  exit 1
fi
 
dpkg-deb -x "$DEBFILE" "$TMPDIR"
dpkg-deb --control "$DEBFILE" "$TMPDIR"/DEBIAN
 
if [[ ! -e "$TMPDIR"/DEBIAN/control ]]; then
  echo DEBIAN/control not found.
 
  rm -r "$TMPDIR"
  exit 1
fi
 
CONTROL="$TMPDIR"/DEBIAN/control
 
MOD=`stat -c "%y" "$CONTROL"`
vi "$CONTROL"
 
if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then
  echo Not modfied.
else
  echo Building new deb...
  dpkg -b "$TMPDIR" "$OUTPUT"
fi
 
rm -r "$TMPDIR"

via HOWTO: Easily modify dependencies of a .deb file – Ubuntu Forums.

Ralink 3090 driver : Markus Heberling

By , 2010-06-25 22:33

ppa:markus-tisoft/rt3090

via Ralink 3090 driver : Markus Heberling.

Driver for the cheap Ralink wireless in the Acer Aspire Revo.

Headless uTorrent Linux server in OpenVZ

By , 2010-06-13 21:10

Yes, I know, another Linux post. What can I say, this is what I do these days.

I’ve been running a Windows server in a kvm VM just to be able to run uTorrent. This was overkill, had a crazy amount of overhead, and was unstable (downloading to a share on my Samba server). Today I decided to attempt a more efficient solution: uTorrent in Wine. (Yes, there are other BitTorrent clients, and even… NATIVE Linux clients, but I’ve found none of them match the speed of uTorrent for my connection except for kTorrent. However, I don’t have an Android and/or iPhone app to remote control kTorrent.) Wine is a supported platform, according to the uTorrent website, however I wanted to run it on a headless OpenVZ container, and not on a standard desktop Linux distro. Should still be pretty simple, but knowing me, I might forget something next time I try and set this up, so I’ll document it here.

  1. Create a fresh VZ container. I used the Proxmox Debian 6.0 (squeeze) – standard i386 template.
  2. Edit /etc/apt/sources.list to point to a fast mirror in Canada (iweb!)
    deb http://debian.mirror.iweb.ca/debian squeeze main contrib non-free
    deb http://debian.mirror.iweb.ca/debian-security squeeze/updates main contrib non-free
  3. run an apt-get update && apt-get upgrade
  4. apt-get install wine sudo xterm openbox tightvncserver
  5. adduser matt
  6. add google repo: http://www.google.com/linuxrepositories/apt.html
  7. install Google Chrome
  8. wget http://download.utorrent.com/2.0.2/utorrent.exe
  9. From another PC: ssh -Y matt@openvz-container
  10. wine winecfg
  11. run vncserver and set a password.
  12. run wine utorrent.exe
  13. Enable Web UI

Next steps:

  1. Set up Dropbox for easy adding of torrents: http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall
  2. Make uTorrent and VNC server run on container startup*
  3. Create a VZ mount script so that torrents download outside of /vz area.

* For this I used a cool script obtained from http://www.abdevelopment.ca/blog/start-vnc-server-ubuntu-boot :

  1. Modify your ~/.vnc/xstartup to start the programs you want (gnome-session, lxde-session, utorrent, etc.)
  2. Save the following script as /etc/init.d/vncserver. Change
    export USER="mythtv"

    to the user you want to run the VNC session for.

#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          vncserver
# Required-Start:    networking
# Default-Start:     3 4 5
# Default-Stop:      0 6
### END INIT INFO
 
PATH="$PATH:/usr/X11R6/bin/"
 
# The Username:Group that will run VNC
export USER="mythtv"
#${RUNAS}
 
# The display that VNC will use
DISPLAY="1"
 
# Color depth (between 8 and 32)
DEPTH="16"
 
# The Desktop geometry to use.
#GEOMETRY="x"
#GEOMETRY="800x600"
GEOMETRY="1024x768"
#GEOMETRY="1280x1024"
 
# The name that the VNC Desktop will have.
NAME="my-vnc-server"
 
OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
 
. /lib/lsb/init-functions
 
case "$1" in
start)
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;
 
stop)
log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;
 
restart)
$0 stop
$0 start
;;
esac
 
exit 0

For more info, see the source link.

Setting up Samba on Debian

By , 2010-06-05 10:30

Trying to set up Samba on a Debian server so that shares can be browsed as a guest, and user-authentication is optional. IIRC this is the default behaviour on Ubuntu.
After hours of messing around, I finally decided to grab the /etc/samba/smb.conf from and ubuntu machine and replace the debian one. And what do you know, it works.

seems the key directive is

usershare allow guests = yes

Ubuntu:

#======================= Global Settings =======================

[global]
 log file = /var/log/samba/log.%m
 passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
 obey pam restrictions = yes
 map to guest = bad user
 encrypt passwords = true
 passwd program = /usr/bin/passwd %u
 passdb backend = tdbsam
 dns proxy = no
 server string = %h server (Samba)
 unix password sync = yes
 unix extensions = no
 workgroup = WORKGROUP
 os level = 20
 syslog = 0
 panic action = /usr/share/samba/panic-action %d
 usershare allow guests = yes
 max log size = 1000
 pam password change = yes

Debian:

#======================= Global Settings =======================

[global]
 log file = /var/log/samba/log.%m
 passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
 obey pam restrictions = yes
 null passwords = yes
 encrypt passwords = yes
 public = yes
 passdb backend = tdbsam
 passwd program = /usr/bin/passwd %u
 unix extensions = no
 dns proxy = no
 server string = %h server
 unix password sync = yes
 workgroup = WORKGROUP
 os level = 20
 security = user
 syslog = 0
 panic action = /usr/share/samba/panic-action %d
 max log size = 1000
 pam password change = yes

Simple fix for Mac OS X 10.6.3 Samba Write Access problem – OS X Daily

By , 2010-06-02 21:53

Simple fix for Mac OS X 10.6.3 Samba Write Access problem – OS X Daily.

Why this hasn’t been fixed yet is beyond me.

Netgear WNDA3100v1 driver only

By , 2010-05-25 00:33

The Netgear WNDA3100 is a pretty nice wireless adapter, but the drivers from Netgear are bundled with a crappy management software. I extracted the basic driver files from the .exe provided so that I can install the hardware using the Windows standard methods.

The 7z contains the Windows XP/2003 and Vista/7 drivers.

WNDA3100v1 Driver

Macfusion: The world in your Finder

By , 2010-03-22 20:41

Macfusion: The world in your Finder.

A handy gui to MacFUSE – user-space filesystem for Mac OS X

Enabling ATSC & QAM in Canada for Windows 7 RTM – Peter Near’s Blog

By , 2010-02-12 18:16

Enabling ATSC & QAM in Canada for Windows 7 RTM – Peter Near’s Blog.

Today, I wanted to PVR the Vancouver 2010 opening ceremonies in HD, but was dismayed to find that Windows Media Center does NOT support ATSC if your region is set to Canada. Fortunately resourceful users have found a workaround patch. See link above.

Snow Leopard on Dell Inspiron 640m/e1405 UPDATED

By , 2010-01-18 09:38

Update 3: For anyone looking for it: 10.6.2-IONDRVSupport.kext

Update 2: My Inspiron worked great, but took FOREVER to boot because it was “Waiting for DSMOS”. Today I finally took the time to do a quick google and found the solution:

in terminal, type “sudo chown root:wheel /” and restart

It seems the owner of the root somehow gets messed up, probably after Chameleon install (just a wild guess).
Thanks to bertmannaustria @ InsanelyMac! (Original thread)

Update: For anyone who is having problems, I have a new kext package. This is a zip of my /Extra folder that I’m using right now on my Inspiron 640m. 640mExtra-Updated Also my system is 32-bit only, so I can’t guarantee this will work in 64-bit mode.

After much trial and error, I finally found the proper procedure for installing Snow Leopard onto my Inspiron 640m. For reasons that I cannot fathom, I was unable to perform the chameleon cdboot/swap to boot from the retail Snow DVD. It might be my DVD drive, or some other cause, but I didn’t bother finding out; I just took the hard drive out of my laptop and connected it via USB to my iMac.

Here’s the procedure that I followed yesterday to install Mac OS X 10.6.0 on my Inspiron 640m. It’s tested, working and stable, everything is great except that this laptop does NOT wake from sleep. It goes to sleep just fine, just won’t wake. Here goes:

  1. Remove hard drive from the Inspiron. Connect it using a hard drive dock or USB to SATA enclosure/adapter.
  2. Put Mac OS X Snow Leopard DVD into existing Mac (Hackintosh or real mac, doesn’t matter).
  3. Using Disk Utility, partition your Inspiron’s drive as you like, using a GUID Parition table.
  4. With your Snow Leopard DVD mounted, in Finder, choose Go to folder. In the box that comes up type “/Volumes/Mac OS X Install DVD/System/Installation/Packages”.
  5. This will open a folder with a lot of install pkgs. Find OSInstall.mpkg and double-click it.
  6. Follow the steps to install Snow Leopard, making sure to pick the proper drive for installation.
  7. Once the installation is done, eject your USB drive and put the hard drive back in your Inspiron.
  8. Download the Inspiron6400.iso and burn it to a CD.
  9. Power up your Inspiron and boot from the CD
  10. From the Chameleon menu, use the arrow keys to select the hard drive.
  11. Type the following boot arguments: -v cpus=1
  12. Your Inspiron should boot into Snow Leopard. Congratulations!
  13. Download my 2 Inspiron kext packages: Inspiron640mExtensions Inspiron640mExtra
  14. In the Inspiron640mExtensions, you will find kext helper. Run it, and drag AppleBCM440XEthernet.kext, VoodooBattery.kext and VoodooHDA.kext onto it, enter password and install.
  15. You will also find the Chameleon RC4 installer. Run it, but DON’T reboot at the end.
  16. Extract the Inspiron640mExtra.zip. Copy the contents of the extracted Extra folder to /Extra.
  17. Remove the Inspiron6400 CD and reboot. hopefully your laptop should boot fine from the hard drive.

Just a few notes:

  • I cannot get the laptop to wake from sleep. As such, the SleepEnabler.kext is not included. I also included the InsomniaX app which you might choose to install to prevent your laptop from sleeping.
  • This method seems to be update-safe. I just updated to 10.6.2 using Software Update and all is ok.
  • When the clamshell display is closed, the Dell BIOS or something blanks the screen. Mac OS cannot re-enable the screen and you’ll be stuck staring at a black LCD. To circumvent this, set one of your screen corners in Expose prefs to put the display to sleep. If ever you find yourself with a black screen, move the cursor to that corner to force the display to sleep, then wake it up again.
  • The Intel PRO 3945 ABG wireless card that came with my Inspiron (and all Inspirons that are branded “Centrino”) does NOT work with Mac OS X. I swapped mine for a Dell 1505 Draft-N card (cheap on eBay) that works perfectly out-of-the-box.
  • The Broadcom 440x ethernet card seems to work fine, I tested it briefly with some light web browsing. However, the original thread says that the driver occasionally drops connections, so YMMV.
  • Finally, a quick thanks to all the OSX86 devs. None of the kexts found here are made by me, all credit goes to the original authors. I found all the necessary info over at the InsanelyMac forum.

Custom theme by me. Based on Panorama by Themocracy