Blog
All my blogging here :D
Make a text file and in it put:
NET USE X: \\servername\%username%
REG DELETE HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\##servername#%username% /v _LabelFromReg /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\##servername#%username% /v _LabelFromReg /t REG_SZ /d WHATEVERYOUWANTTOCALLYOURDRIVE
Save the file, change its ending to .bat and run it as a logon script
If it works as planned, each user should then see a drive "X:" with whatever you want to call it.
Note that the samba share must be the same name as the username
This came from a friend V0lZy on Freenode IRC.
This is a howto remove Linux such as Ubuntu from a dual boot Windows setup.
There is a free utility to replace the boot loader back to what Vista uses, called Easy BCD from NeoSmart Technologies. Which can be downloaded here.
Here is a screen shot of how simple it is to restore the master boot record.
Now it's a simple matter of going into "disk management" in Windows and removing the Linux partition and resizing the Windows one.
This short script will remove old *.desktop files that point to missing WINEPREFIXs
#!/bin/sh
# Created by Danny Rawlins, <Romster> on freenode.
#
# This cleans out menu *.desktop files for missing WINEPREFIX
# find and delete wine menu files for missing WINEPREFIX
find "${HOME}/.local/share/applications/wine/" -type f -print | while IFS="$(printf "\n\b")" read FILE; do
if [ ! -e "$(grep '^Exec=' "${FILE}" | sed -ne 's|.*WINEPREFIX="\([^\"]*\)".*|\1|p')" ]; then
rm "${FILE}"
fi
done
# remove empty directorys
find "${HOME}/.local/share/applications/wine/" -depth -empty -exec rm -rf '{}' \;
# End of file
List the partiton table on the file then. we calculate the offset for mount in this example.
lists.img1 * 63 208844 104391 83 Linux
The equation is: "start sector * block size = offset"
63 * 512 = 32256
So in this example the command to mount this is.
Note that there is a easier way using the command 'kpartx' found in 'multipath-tools'.
Have sda1 as a LVM2 volume and would like to convert it to LVM on RAID1?
Create the degraded RAID1
Do the LVM stuff.
# vgextend <VolumeGroupName> <PhysicalDevicePath>
# pvmove <SourcePhysicalVolume> <DestinationPhysicalVolume>
# vgreduce <VolumeGroupName> <PhysicalVolumePath>
You may want/need to clear the partition table and boot loader on the empty disk
Add the now empty disk to <md0>
Rebuild the RAID array
I decided to play with some ANSI colour and position codes and I have always liked this old DOS activity bar so I decided to recreate it.
for a in {1..10}; do
for i in \| / - \\; do
printf -- "\033[1m\033[94m%s\033[u" "$i"
perl -e 'select(undef,undef,undef,.25)'
done
done
printf "\033[?25h\033[0m\n"
First off I will assume you have a working setup.
We should already have the loopback and first lan interface like this example.
/sbin/ip link set lo up
/sbin/ip addr add 192.168.0.1/24 dev eth1 broadcast +
/sbin/ip link set eth1 up
Now we add in the second one like so.
/sbin/ip link set eth2 up
Giving it a new IP number.
Now we add a forward rule to allow out bound connections if the default policy is set to DROP (recomended).
And add inbound rules as required.
Inbound shaping for a number of clients on a slow network.
First off we setup IMQ and set some defaults
ip link set imq0 up
ip link set txqueuelen 16 imq0
ip link set mtu 1500 imq0
Add root class.
Add leaf class to root class
tc class add dev imq0 parent 1:1 classid 1:100 hfsc ls rate 300kbit ul rate 400kbit
tc class add dev imq0 parent 1:1 classid 1:110 hfsc ls rate 100kbit ul rate 400kbit
Add leaf class to class 100
tc class add dev imq0 parent 1:100 classid 1:202 hfsc ls rate 60kbit ul rate 400kbit
tc class add dev imq0 parent 1:100 classid 1:203 hfsc ls rate 60kbit ul rate 400kbit
tc class add dev imq0 parent 1:100 classid 1:204 hfsc ls rate 60kbit ul rate 400kbit
tc class add dev imq0 parent 1:100 classid 1:205 hfsc ls rate 60kbit ul rate 400kbit
Attach qdisc to leaf classes
tc qdisc add dev imq0 parent 1:110 sfq perturb 10 quantum 1500
tc qdisc add dev imq0 parent 1:201 sfq perturb 10 quantum 1500
tc qdisc add dev imq0 parent 1:202 sfq perturb 10 quantum 1500
tc qdisc add dev imq0 parent 1:203 sfq perturb 10 quantum 1500
tc qdisc add dev imq0 parent 1:204 sfq perturb 10 quantum 1500
tc qdisc add dev imq0 parent 1:205 sfq perturb 10 quantum 1500
iptables ‐t mangle ‐I PREROUTING ‐i ppp0 ‐d 192.168.1.2 ‐j CLASSIFY ‐‐set‐class 202:1
iptables ‐t mangle ‐I PREROUTING ‐i ppp0 ‐d 192.168.1.3 ‐j CLASSIFY ‐‐set‐class 203:1
iptables ‐t mangle ‐I PREROUTING ‐i ppp0 ‐d 192.168.1.4 ‐j CLASSIFY ‐‐set‐class 204:1
iptables ‐t mangle ‐I PREROUTING ‐i ppp0 ‐d 192.168.1.5 ‐j CLASSIFY ‐‐set‐class 205:1
Instruct these packets to go through the imq0 device.
I decided to try running starcraft in a new Xorg server and here is how I did it.
First switch to a new empty console
Now log in and then type.
Now to lower the screen resolution to 640x480
Change directory to the game and start it.
$ wine StarCraft.exe
Now you can jump between your game and your normal desktop with.
and
When you're done you can exit the game then type
to get back to tty2, then if you wish to logout
And switch back to your existing desktop