lunes, 22 de octubre de 2012

Crear usb de Windows7 desde Linux

# fdisk /dev/sdb (partition type 7, and bootable flag)

# mkfs.ntfs -f /dev/sdb1

# ms-sys -7 /dev/sdb


# mount -o loop win7.iso /mnt/iso
# mount /dev/sdb1 /mnt/usb
# cp -r /mnt/iso/* /mnt/usb/
Fuente: http://serverfault.com/questions/6714/how-to-make-windows-7-usb-flash-install-media-from-linux

lunes, 20 de agosto de 2012

Arrancar instalacion de Windows 7 desde pen


1. Formatear el pendrive de 4 GB como NTFS con tamaño de asignacion predeterminado.
2. Extraer el ISO de Windows 7 con el 
3. Abrir una consola con permisos de administrador y tipear C:/Disco_De_Windows7_Descomprimido/boot/bootsect.exe /nt60 F: (donde F es la letra de la unidad del pendrive, esto hace que el pendrive sea booteable, tambien sirve para instalar el Vista desde un pendrive). 
4. Pasar todo el contenido del iso descomprimido al pendrive. 


(taringa: http://www.taringa.net/posts/info/2071814/Instalar-Windows-7-desde-un-pendrive.html)

domingo, 13 de mayo de 2012

Recursive Unrar Script for Windows


Por si no tengo cygwin:
Step 2: Change to the directory containing the folders for the episodes you want to extract. For example:
cd "\Users\Steve\Downloads\My Favorite Show - Seasons 1-6\My Show - Season 1"
Step 3: Now that we are in the folder containing all the sub-folders to each episode for your show, type in the following command to extract all of the episodes:
for /R %i IN (.) do "c:\Program Files\WinRAR\Rar.exe" x "%i/*.rar"

jueves, 29 de septiembre de 2011

Warning: date(): It is not safe to rely on the system's php.ini


Editar /etc/php.ini y añadir:
date.timezone = "Europe/Madrid"

domingo, 4 de septiembre de 2011

Comparar 2 ficheros de texto línea a línea

Siempre lo intento hacer con el comando "comm", pero nunca sale el resultado esperando si el fichero es demasiado grande.. en perl:

#!/usr/bin/perl

use Data::Dumper;


open(A,"$ARGV[0]");
@a1=;
close A;

open(B,"$ARGV[1]");
@a2=;
close B;

my @a  = array_differenz(\@a1, \@a2);
foreach (@a) { print; }


sub array_differenz ($$) {
my $a1   = shift; # array reference
my $a2   = shift; # array reference

my @a1m2 = @$a1;  # array 1 minus array 2;

for my $element (@$a2) {
for my $index (0..$#a1m2) {
if ($element eq $a1m2[$index]) {
splice @a1m2, $index, 1;
last;
}
}
}

my @a2m1 = @$a2;  # array 2 minus array 1;

for my $element (@$a1) {
for my $index (0..$#a2m1) {
if ($element eq $a2m1[$index]) {
splice @a2m1, $index, 1;
last;
}
}
}

return (@a1m2, @a2m1);

} # sub array_differenz


jueves, 1 de septiembre de 2011

Velocidad en discos USB en linux

De: http://www.linux-usb.org/FAQ.html#i5

A:For USB Mass Storage devices (that is, devices which use the usb-storage driver) max_sectors controls the maximum amount of data that will be transferred to or from the device in a single command. As the name implies this transfer length is measured in sectors, where a sector is 512 bytes (that's a logical sector size, not necessarily the same as the size of a physical sector on the device). Thus for example, max_sectors = 240 means that a single command will not transfer more than 120 KB of data.

Linux 2.6 gives you the ability to see and to change the max_sectors value for each USB storage device, independently. Assuming you have a sysfs filesystem mounted on /sys and assuming /dev/sdb is a USB drive, you can see the max_sectors value for /dev/sdb simply by running:

cat /sys/block/sdb/device/max_sectors
and you can set max_sectors to 64 by running (as root):

echo 64 >/sys/block/sdb/device/max_sectors
Values should be positive multiples of 8 (16 on the Alpha and other 64-bit platforms). There is no upper limit, but you probably shouldn't make max_sectors much bigger than 2048 (corresponding to 1 MB, which is quite a lot).

In general, increasing max_sectors will improve throughput since it means that larger amounts of data can be transferred in a single command with no need for being split up among multiple commands. Of course this is subject to diminishing returns when max_sectors is very big. More importantly, it's true only up to a point. Many devices have limits on the amount of data they can transfer, and if you try to exceed that limit you will most likely crash the device.

martes, 15 de marzo de 2011

VMWare Player en Linux con SELinux

Hay que modificar los /dev/vmnet*

ls -Za /dev/vmne*
crw-------. root root unconfined_u:object_r:device_t:s0 /dev/vmnet0
crw-------. root root unconfined_u:object_r:device_t:s0 /dev/vmnet1
crw-------. root root unconfined_u:object_r:device_t:s0 /dev/vmnet8

Mediante:

restorecon -v /dev/vmnet1
restorecon -v /dev/vmnet0
restorecon -v /dev/vmnet8


ls -Za /dev/vmne*
crw-------. root root system_u:object_r:vmware_device_t:s0 /dev/vmnet0
crw-------. root root system_u:object_r:vmware_device_t:s0 /dev/vmnet1
crw-------. root root system_u:object_r:vmware_device_t:s0 /dev/vmnet8

viernes, 11 de marzo de 2011

Alt-gr en vmware sobre un linux

Editar /etc/vmware/config


xkeymap.keycode.108 = 0x138 # Alt_R
xkeymap.keycode.106 = 0x135 # KP_Divide
xkeymap.keycode.104 = 0x11c # KP_Enter
xkeymap.keycode.111 = 0x148 # Up
xkeymap.keycode.116 = 0x150 # Down
xkeymap.keycode.113 = 0x14b # Left
xkeymap.keycode.114 = 0x14d # Right
xkeymap.keycode.105 = 0x11d # Control_R
xkeymap.keycode.118 = 0x152 # Insert
xkeymap.keycode.119 = 0x153 # Delete
xkeymap.keycode.110 = 0x147 # Home
xkeymap.keycode.115 = 0x14f # End
xkeymap.keycode.112 = 0x149 # Prior
xkeymap.keycode.117 = 0x151 # Next
xkeymap.keycode.78 = 0x46 # Scroll_Lock

lunes, 18 de octubre de 2010

Cambiar proximo reinicio en grub - Lilo -R

echo "savedefault --default=1 --once" | grub --batch

viernes, 1 de octubre de 2010

arp static en Windows7

Ejemplo:
netsh interface ipv4 add neighbors "Local Area Connection" 192.168.0.1 00-24-01-d2-3a-bd