Loriano Storchi's HomePage


[Home] [CV and Research] [Any Other Business] [Where Contact Info] [Lecture Notes]

Some useless help

   

----------------------------------------------------------------------------------
 
per fetchmail visto che non risponde a locahost mettere in /etc/mail/local-host-names
e un make nella dir /etc/mail/

# local-host-names - include all aliases for your machine here.
localhost
nomehost
nomehost.dominio.it
127.0.0.1

dopo di che in .fetchmailrc 

poll imap.server protocol imap username "username" password "xxxxxxxx" fetchall flush ssl is locausername smtphost 127.0.0.1

----------------------------------------------------------------------------------

Per xscreensaver e agente ssh

#!/bin/bash

export TEST="The screensaver is active"
export BLANK=0

while [  0 -lt 10 ]; do 
  export SCREENLOCK=$(gnome-screensaver-command -q) 
  if [ "$SCREENLOCK" = "$TEST" ]; then
    if [ $BLANK -eq 0 ]; then
      ssh-add -D
      BLANK=1
    fi
  else 
    if [ $BLANK -eq 1 ]; then
      ssh-add < /dev/null
      BLANK=0
    fi
  fi
  sleep 10
done

semplice script che chiaramente deve essere migliorata e sistemata.

----------------------------------------------------------------------------------

per far eseguire firefox sempre da remoto dopo un ssh

122 export MOZ_NO_REMOTE=1
123 alias firefox='firefox -P'

----------------------------------------------------------------------------------

rpm duplicati

rpm -qa --qf '%{name}\n'| sort | uniq -d 

per avere la lista

----------------------------------------------------------------------------------

iptab

----------------------------------------------------------------------------------

google search for a web cam:

inurl:/view/index.shtml

----------------------------------------------------------------------------------

estrai la lista dei common

grep "COMMON" * | grep -v "C\*\*" | awk '{print $2, $3}' | sort -k 2 | uniq -c

----------------------------------------------------------------------------------

FlashPlayer x86_64

pacchetto .tar.gz flashplayer:

http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash

nspluginwrapper (per fedore src.rpm rpmbuild --rebuild nspluginwrapper-0.9.91.5-1.src.rpm)

Copiamo i file libflashplayer.so flashplayer.xpt nella dir dove risiedono tutti 
i plugin di mozilla/firefox: /usr/lib64/mozilla/plugins/

dare il comando:

# /usr/lib/nspluginwrapper/x86_64/linux/npconfig -i /usr/lib64/mozilla/plugins/libflashplayer.so

----------------------------------------------------------------------------------

Java Runtime Environment 1.4.2 (Blackdown)
Version: 1.4.2_03
SeaMonkey 1.1a, Firefox 2.0: Works Well
FAQ: Java FAQ

   1. Download Blackdown JRE
   2. Open a terminal, and change to the directory where you wish to install the JRE (eg. /usr/java)
   3. Run the Blackdown JRE package executable. This will extract the JRE in the current directory.
   4. Run the following command: ln -s ./j2re1.4.2/plugin/amd64/mozilla/libjavaplugin_oji.so ~/.mozilla/plugins/libjavaplugin_oji.so

Important! It is critical that you create a symbolic link to the Java plugin rather than copying it. If you copy it, your browser will crash whenever you load a page that has a Java applet.
Download Blackdown JRE 1.4.x

As for the java plugin problem. There is only one native 64bit java plugin available and it's the Gnu Java compiler one. 
Make soft link from the file

/usr/lib64/gcj-4.1.1/libgcjwebplugin.so to /usr/lib64/mozilla/plugins/libgcjwebplugin.so

It's only 1.4.2, but it works very well.

----------------------------------------------------------------------------------

#include 

int main () {

  if (index > 0) {
    std::cout << "Here" << std::endl;
  }

  if (strcat > 0) {
    std::cout << "Here" << std::endl;
  }

  return 0; 
}

compile it .... 

$ g++ -W -Wall -o main main.cpp
$ ./main 
Here
Here

mhmhmhmh ....

$ man index
----------------------------------------------------------------------------------

tar cf - ./$name |  ssh root@backupsystem.it "cd /home; tar xvpf -"

----------------------------------------------------------------------------------
#!/bin/bash

for name in `ls *.jpg | sed 's/.jpg//'`
do 
   convert -resize 500 $name.jpg $name\_r.jpg 
   echo ""
done

----------------------------------------------------------------------------------

a dcopy mkl debug:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000695e75 in Steps1_X8_Y16_Loop32 ()
(gdb) disassemble 
Dump of assembler code for function Steps1_X8_Y16_Loop32:
0x0000000000695e40 :	cmp    $0x20,%rdi
0x0000000000695e44 :	jl     0x695f70 
0x0000000000695e4a :	movaps 0x0(%rsi),%xmm1
0x0000000000695e4e :	movaps 0x10(%rsi),%xmm2
0x0000000000695e52 :	movaps 0x20(%rsi),%xmm3
0x0000000000695e56 :	movaps 0x30(%rsi),%xmm4
0x0000000000695e5a :	movaps 0x40(%rsi),%xmm5
0x0000000000695e5e :	movaps 0x50(%rsi),%xmm6
0x0000000000695e62 :	movaps 0x60(%rsi),%xmm7
0x0000000000695e66 :	movaps 0x70(%rsi),%xmm8
0x0000000000695e6b :	shufpd $0x1,%xmm1,%xmm0
0x0000000000695e70 :	shufpd $0x1,%xmm2,%xmm1
0x0000000000695e75 :	movaps %xmm0,0x0(%rcx)
0x0000000000695e79 :	movaps %xmm1,0x10(%rcx)

...
(gdb) p/x $rcx 
$3 = 0xa39fec
(gdb) x 0xa39fec
0xa39fec :	0x00000000
(gdb) x/8f 0xa39fec
0xa39fec :	0	0	0	0
0xa39ffc :	0	0	0	0

riferimento a struttura dati f90 interna, l'indirizzo direi e' valido visto il risultato
dei due x. Googling a bit about movaps, many nice stuff comes out.

movaps xmm, [mem|reg] = copy a 4-element vector (of 32-bit floats, for
a total of 128 bits) from memory to an xmm vector register. the "a" in
movaps means that alignment (on a 128-bit boundary) is required, there's
also an unaligned load. 

SSE extensions

for example: http://www.bailopan.net/blog/?p=7

----------------------------------------------------------------------------------

      program test

      implicit none

      integer :: maxorb
      parameter(maxorb=1024)

      type :: t4_type
        integer :: firstint
        integer :: occ(maxorb)
      end type t4_type

      type :: t4_type_2
        integer :: firstint, secondint
        integer :: occ(maxorb)
      end type t4_type_2

      integer norb, i, occi(maxorb)

      type (t4_type) :: t4
      type (t4_type_2) :: t42

      real*8 :: pop(maxorb)

      do i=1,maxorb
       pop(i) = i
       t4%occ(i) = 0
      enddo

      norb = 250

      call testa (norb,pop,occi)

      print *, "first"

      call testa (norb,pop,t42%occ)

      print *, "second"

      call testa (norb,pop,t4%occ)

      print *, "third"

      end

      subroutine testa (norb,pop,occ)

      implicit none

      integer norb
      real*8 pop(1), occ

      call dcopy(norb,pop,1,occ,1)
 
      return
      end

$ ifort -check all -r8 -o test main.F90 -L/opt/intel/mkl/lib/em64t -lmkl -lguide -lpthread

on a:

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 15
model name	: Intel(R) Xeon(R) CPU            5160  @ 3.00GHz
stepping	: 6
cpu MHz		: 3000.114
cache size	: 4096 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 2
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm pni monitor ds_cpl est tm2 cx16 xtpr
bogomips	: 6004.35
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:


$ ./test 
 first
 second
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source             
libpthread.so.0    000000307930C430  Unknown               Unknown  Unknown
libmkl_mc.so       0000002A959B8CD5  Unknown               Unknown  Unknown

$ gdb ./test
GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/tls/libthread_db.so.1".

(gdb) r
Starting program: /home/redo/molecule/aug-cc-PVDZ/test/test 
[Thread debugging using libthread_db enabled]
[New Thread 182897156448 (LWP 28485)]
 first
 second

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182897156448 (LWP 28485)]
0x0000002a959b8cd5 in Steps1_X8_Y16_Loop32 () from /opt/intel/mkl/lib/em64t/libmkl_mc.so
(gdb) disassemble 
Dump of assembler code for function Steps1_X8_Y16_Loop32:
0x0000002a959b8ca0 :	cmp    $0x20,%rdi
0x0000002a959b8ca4 :	jl     0x2a959b8dd0 
0x0000002a959b8caa :	movaps 0x0(%rsi),%xmm1
0x0000002a959b8cae :	movaps 0x10(%rsi),%xmm2
0x0000002a959b8cb2 :	movaps 0x20(%rsi),%xmm3
0x0000002a959b8cb6 :	movaps 0x30(%rsi),%xmm4
0x0000002a959b8cba :	movaps 0x40(%rsi),%xmm5
0x0000002a959b8cbe :	movaps 0x50(%rsi),%xmm6
0x0000002a959b8cc2 :	movaps 0x60(%rsi),%xmm7
0x0000002a959b8cc6 :	movaps 0x70(%rsi),%xmm8
0x0000002a959b8ccb :	shufpd $0x1,%xmm1,%xmm0
0x0000002a959b8cd0 :	shufpd $0x1,%xmm2,%xmm1
0x0000002a959b8cd5 :	movaps %xmm0,0x0(%rcx)
...

(gdb) print $rcx
$1 = 5684076
(gdb) x/2g $rcx
0x56bb6c :	0x0000000000000000	0x0000000000000000

5684076 is not aligned on a 16-byte boundary.

(gdb) break *0x0000002a959b8cd0
Breakpoint 1 at 0x2a959b8cd0
(gdb) r
Starting program: /home/redo/molecule/aug-cc-PVDZ/test/test 
[Thread debugging using libthread_db enabled]
[New Thread 182897156448 (LWP 28502)]
 first
[Switching to Thread 182897156448 (LWP 28502)]

Breakpoint 1, 0x0000002a959b8cd0 in Steps1_X8_Y16_Loop32 () from /opt/intel/mkl/lib/em64t/libmkl_mc.so

no segfault

----------------------------------------------------------------------------------

encode some jpeg into an avi

mencoder "mf://*.jpg" -mf type=jpeg:fps=0.2 -o image-video.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=300

----------------------------------------------------------------------------------

trainslate " " in "\n"

cat file  | tr " " "\n" | grep "pdf"

----------------------------------------------------------------------------------

To use different .Xauthority when home in in a shared filesystem. To be used
for example with charmrun (./charmrun +p16 ++ssh-display ++debug 
./diagonalizer_simple). In ~/.ssh/rc 

#########################################################
# /etc/sshrc

# Set up the local file in which to store the .Xauthority information:
export XAUTHORITY=/tmp/.Xauthority.$USER

# Now create and write the magic cookie information:
if read proto cookie && [ -n "$DISPLAY" ]; then
   if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
      # X11UseLocalhost=yes
      echo add unix:`echo $DISPLAY |
      cut -c11-` $proto $cookie
   else
      # X11UseLocalhost=no
      echo add $DISPLAY $proto $cookie
   fi | /usr/X11R6/bin/xauth -q -
fi
#########################################################

in .bashrc

###########################################################
# ~/.bashrc X11 configuration
if [[ -z $DISPLAY ]]; then
   # DISPLAY is not set, so check to see what X display is owned
   # by the current user and set DISPLAY to this value: 
   X11_FOLDER=/tmp/.X11-unix
   currentUser=`id -u`
   bb=`ls -ln $X11_FOLDER | grep $currentUser`
   bbb=${bb/*X/:}
   usedDISPLAY=$bbb.0
   export DISPLAY=$usedDISPLAY
else
   # DISPLAY is set, so we assume remote user login via
   # ssh and set the XAUTHORITY variable to point to 
   # proper file.
   export XAUTHORITY=/tmp/.Xauthority.$USER
fi
###########################################################

----------------------------------------------------------------------------------

FC11

# yum install plymouth-system-theme
# plymouth-set-default-theme charge
# /usr/libexec/plymouth/plymouth-update-initrd

----------------------------------------------------------------------------------

dmidecode is a tool for dumping a computer’s DMI (some say SMBIOS) table contents in a human-readable format. This
table contains a description of the system’s hardware components, as well as other useful  pieces  of  information
such  as  serial numbers and BIOS revision. Thanks to this table, you can retrieve this information without having
to probe for the actual hardware.  While this is a good point in terms of report speed  and  safeness,  this  also
makes the presented information possibly unreliable.

dmidecode

----------------------------------------------------------------------------------

ONDA MT503HSA in Fedora 11

# cd ODTIM_Linux_UI/Alice_MOBILE/driver810

commenta riga onda.c:255

# make
# mv onda.ko /lib/modules/$(uname -r)/kernel/drivers/usb/serial
# depmod -a
# modprobe onda

in /etc/modprobe.d

# cat onda.conf 
options usbserial vendor=0x19d2 product=0x0002

----------------------------------------------------------------------------------

citrix client:

in wfica.sh  insert:

export LANG=C

----------------------------------------------------------------------------------

disable ssh service in gnome-keyring:

gconftool-2 --set -t bool /apps/gnome-keyring/daemon-components/ssh false

----------------------------------------------------------------------------------

tunnel ssh. Volendo accedere as un client remoto dal server se il client non e' 
raggiugibile direttamente, posso usare tunnel ssh:

dal client:

ssh -f -N -R 2333:localhost:22 server

dal server:

ssh -p 2333 localhost

accedo al client se esso ha un server ssh in ascolto sulla porta 22. 

----------------------------------------------------------------------------------

crypt /tmp 

# init 3
# umount /tmp
# cryptsetup  luksFormat /dev/VolGroup00/LogVol00Tmp
# cryptsetup luksOpen /dev/VolGroup00/LogVol00Tmp cryptotmp
# cat /etc/crypttab
cryptotmp /dev/VolGroup00/LogVol00Tmp
# cat /etc/fstab 
/dev/mapper/cryptotmp        /tmp                    ext3    defaults        1 2
# mkfs.ext3  /dev/mapper/cryptotmp
# mount /dev/mapper/cryptotmp  /tmp/

Crypt swap 

# swapoff -a 
# cat /etc/crypttab
cryptoswap /dev/VolGroup00/LogVol00Swap /dev/urandom cipher=aes-cbc-essiv:sha256,size=256,hash=sha256,swap
# cat /etc/fstab 
/dev/mapper/cryptoswap swap  swap   defaults 0 0
# cryptsetup create cryptoswap /dev/VolGroup00/LogVol00Swap

Crypt var da live
dd if=//dev/VolGroup00/LogVol03Var of=var.ext3 
cryptsetup  luksFormat /dev/VolGroup00/LogVol02Var
cryptsetup luksOpen /dev/VolGroup00/LogVol02Var cryptovar
cat /etc/crypttab
  cryptovar /dev/VolGroup00/LogVol02Var
cat /etc/fstab
  /dev/mapper/cryptovar   /var ext3    defaults        1 2
mkfs.ext3  /dev/mapper/cryptovar 
mount -o loop var.ext3 /mnt/oldvar
mount /dev/mapper/cryptovar /mnt/var
cd oldvar 
cp -arfdZ * /mnt/var 

----------------------------------------------------------------------------------

#load device module
modprobe dm-mod
#scan id needed
vgscan
#change the volumes that exist to active
vgchange -ay
#mount the logical partition

----------------------------------------------------------------------------------

   99  apt-get install gcc gcc-3.4 gcc-4.1 gcc-4.2 gcc-4.3 
  104  apt-get install make
  113  apt-get install linux-source-2.6.26
  149  apt-get install ncurses-dev 
  168  apt-get install linux-headers-2.6.26-2-amd64 


Next we unpack the downloaded Kernel Source in /usr/src.

tar xjvf linux-source-2.6.26.tar.bz2

ln -s linux-source-2.6.26 linux

Before we can start the CUDA Driver Installation we must set our environment to use the right gcc version, so in my case:

export CC="gcc-4.1"

Now we are ready for the CUDA Driver.

sh cudadriver_2.3_linux_64_190.18.run

----------------------------------------------------------------------------------

a DOS/MAC to UNIX text file format converter

dos2unix

----------------------------------------------------------------------------------

user home with apache fedora 12 

   1. Edit /etc/httpd/conf/httpd.conf file.
      ‘UserDir disabled’ to ‘UserDir enabled ’.
      Uncomment ‘UserDir public_html’ line.
      Uncomment the whole ‘’ section until the ‘’.
   2. permissions:
      # chmod 711 ~
      # chmod 755 -R ~/public_html/
   3. selinux problem:
      # setsebool -P httpd_enable_homedirs true
      # chcon -R -t httpd_sys_content_t ~/public_html   # It looks like it’s not necessary. See dgrift’s comments below.

----------------------------------------------------------------------------------

LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so vgrabbj -d /dev/video0 -f grab.jpg 

per motion su debian:

export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so 
/usr/bin/motion

se usi la start script potrebbe non funzionare, run it as root

----------------------------------------------------------------------------------

ricerca per sottostrutture:

babel -s C1CCCCN1 -imol2 *.mol2 -osdf test.sdf

----------------------------------------------------------------------------------

recover deleted files:

photorec

----------------------------------------------------------------------------------

Ho avuto la sfortuna di mettere le mani su un nokia c3 00 , per dover impostare 
account email e whatsApp ... dopo un po' si intuisce come sia necessario
impostare oltre la connessione intenet web gli stessi parametri (anzi un subset) 
anche per accesso di sincronizzazione. Ad esempio Wind:

Impostazioni-> Configurazione -> Impostazioni Personali 

a questo punto: opzioni -> Aggiungi e selezione Sincronizzazione 

Nel caso wind il punto di accesso sara' intenet.wind

----------------------------------------------------------------------------------

For Loop File Names With Spaces

for loop uses $IFS variable to determine what the field separators are

IFS=$(echo -en "\n\b")

http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html

----------------------------------------------------------------------------------
EFI shell:

eamples:

mount blk1 
blk1:

use cd and ls to navigate the dirs

http://software.intel.com/en-us/articles/efi-shells-and-scripting/

----------------------------------------------------------------------------------

backup a running VirtualBox VM machine, where vmname is the VM name, and user
is the user owing the virtual machine, after a backup /home where is the VDI and
the snapshot in my case:

su user -c "VBoxManage controlvm vmname savestate"

rsync --progress -av -l --ignore-errors --delete ./home /backup

su user -c "VBoxHeadless -startvm vmnamer &"


----------------------------------------------------------------------------------

Gaussian 09 compilation problem in IA64. While compiling g09 on a IA64 
architecture I encountered a minor compilation problem. Line 2769 of bsd/mdutil.c 
need to be fixed as follow:

 f77_int wait_(ist) f77_int *ist; {pid_t wait(); return(wait((int *) ist)); }

need to check

----------------------------------------------------------------------------------

read Arduino serial output using python:

import serial

ser = serial.Serial('/dev/ttyACM0', 9600)

while 1:
  print ser.readline()

----------------------------------------------------------------------------------

dump an image from motion :

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#define IPADDR "127.0.0.1"      
#define PORTBASE 8080           
#define UPPERCAMERANUMBER 13   

int
main (void)
{
  int sockfd;
  int len, n;
  int result;
  int jpglength;
  FILE *fd, *out;
  int cameranumber;
  char garbage1[80] = "";
  char garbage2[30] = "";
  char chbuffer[40000] = "";
  struct sockaddr_in address;

  cameranumber = 1;

  sockfd = socket (AF_INET, SOCK_STREAM, 0);

  address.sin_family = AF_INET;
  address.sin_addr.s_addr = inet_addr (IPADDR);
  address.sin_port = htons (PORTBASE + cameranumber);
  len = sizeof (address);

  result = connect (sockfd, (struct sockaddr *) &address, len);

  if (result == -1)
  {
    perror ("ERROR: Cannot connect to Motion");
    return 1;
  }

  fd = fdopen (sockfd, "r");

  if (fd == NULL)
  {
    perror ("ERROR: Cannot connect to Motion");
    return 1;
  }

  while (strncmp (garbage1, "Content-Length:", 15) != 0)
    fgets (garbage1, 70, fd);

  sscanf (garbage1, "%s%d", garbage2, &jpglength);

  fgets (garbage1, 70, fd);

  fread (chbuffer, 1, jpglength, fd);
  //fprintf (stdout, "HTTP/1.1 200 OK\n");
  //fprintf (stdout, "Content-Type: image/jpeg\n\n");

  out = fopen ("actual.jpeg", "w");
  if (out == NULL)
  {
    perror ("oops: Cannot open out file");
    return 1;
  }

  n = fwrite (chbuffer, 1, jpglength, out);
  if (n != jpglength)
  {
    perror ("Error: Cannot write full jpeg");
    return 1;
  }

  fclose (fd);
  fclose (out);
  close (sockfd);

  return 0;
}

----------------------------------------------------------------------------------

g++ link_flags_if_needed -o exe objects -Wl,-Bstatic static_lib_list -Wl,-Bdynamic dinamic_lib_list

----------------------------------------------------------------------------------

Add eth0 iface with a specific MAC:

ip link add link p4p1 name eth0 MACADDR type macvlan

----------------------------------------------------------------------------------

resize a FS with LVM


# lvresize -L +XXG <path to fs device>
# resize2fs <path to fs device>

if you have non free space and a scratch FS:

# umount /scratch
# lvresize -L +XXG <path to fs scatch device>
# mkfs.ext4 <path to fs scatch device>
# mount /scratch

and after the first two command


----------------------------------------------------------------------------------

put zeros:

for a in object*.sdf; do na=$(echo $a | sed 's/object//g'); b=$(printf object%05d.sdf ${na%.sdf}); echo $b; mv $a $b ; done

----------------------------------------------------------------------------------

Remove a broken disk (LVM):

sdf is the new disk :

# pvcreate /dev/sdf
# vgextend gw_vg /dev/sdf

Move data (/dev/sdb old disk):

# pvmove /dev/sdb /dev/sdf
# vgreduce gw_vg /dev/sdb

----------------------------------------------------------------------------------

resize virtual disk size:

VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB  

----------------------------------------------------------------------------------

Plot p GTO orbital:

http://www.ccl.net/cca/documents/basis-sets/basis.html

gnuplot> f(x,y,z) = 2.7**(-0.4555*sqrt(x**2+y**2+z**2))*x
gnuplot> splot f(x,y,0), f(x,y,1), f(x,y,2), f(x,y,3)

http://shpenkov.janmax.com/HybridizationShpenkov.pdf

http://en.citizendium.org/wiki/Gaussian_type_orbitals

http://en.citizendium.org/wiki/Spherical_harmonic

----------------------------------------------------------------------------------

Resize fs on LVM:

   umount /home/
   e2fsck -f  /dev/mapper/vg_bwmcc-lv_home
   resize2fs /dev/mapper/vg_bwmcc-lv_home 1600G
   lvreduce -L -100G /dev/mapper/vg_bwmcc-lv_home
   lvcreate -l 100%FREE -n lv_local vg_bwmcc
   mkfs.ext4 /dev/mapper/vg_bwmcc-lv_local
   mount /dev/mapper/vg_bwmcc-lv_local /usr/local/

----------------------------------------------------------------------------------

peak performance (GFLOPS) for a single node: 

GFLOPS = ( number_of_CPU ) * ( number_of_cores_per_CPU ) * GHz * MULTI

where MULTI is specific to the kind of CPU, that is floating point operations per cycle.

example, Intel Xeon E5-2600 (Sandy Bridge) series has MULTI = 8

----------------------------------------------------------------------------------

DC5 DF4EBBEEABA7

----------------------------------------------------------------------------------

Hidden Wiki 

http://kpvz7ki2v5agwt35.onion/wiki/index.php/Main_Page

----------------------------------------------------------------------------------

Missed ftp password ?

# dsniff -i ethX 

Password Sniffing with “dsniff” on the Local Network 

----------------------------------------------------------------------------------

after a Ctrl-D reboot to modify root fs:

# mount -o remount,rw /

----------------------------------------------------------------------------------

Too many semaphores (DDI Process 0: semget return an error.
 semget errno=ENOSPC -- check system limit for sysv semaphores.
 DDI Process 0: error code 911
 DDI Process 9: semget return an error.)

ipcs to list semaphores and all other IPC communication channels 
after ipcrm to remove them.

ipcs -s | awk '{print $2}' | xargs

and after :

for id in ...... 
do
  ipcrm -s $id
done

same with -m and so on....

----------------------------------------------------------------------------------

ReadyNAS netgear cannot obtain root access via NFS. Easy workaround , install ssh 
access plugins and charge ownership diredtly using the readynas shell 
(i.e. internally)

----------------------------------------------------------------------------------

private http proxy. Remote host with squid installed listening to loopback and 
from the client run:

ssh -C2qTnN -L 8080:localhost:8080 remotehost

set proxy to 127.0.0.1:8080 in your browser

----------------------------------------------------------------------------------

Adding a mirror to an existing LVM volume
Purpose
Mirror a LVM volume, e.g. add a mirror to proxmox's root/swap/data so that locally created VMs are protected from disk failure.

Prerequisities 2 physical disks.

add second disk to the volume group containing the volumes you want to mirror:

pvcreate /dev/sdb1 # /dev/sdb1 is the physical disk to contain the mirrors

vgextend pve /dev/sdb1  # pve is volume group name you wish to extend

lvconvert -m 1 --corelog pve/data # -m 1 (how many mirrors to create) --corelog (keep the log in memory, requires a resync on reboot)

----------------------------------------------------------------------------------

mpirun --mca btl_tcp_if_exclude virbr0 -pernode --hostfile ./hostnames -n 2 ./mpitest

exclude virbr0 interface, so openmpi wont use the given interface

----------------------------------------------------------------------------------

MAC OSX
 
diskutil partitionDisk disk2 1 GPT HFS+ extdisk R

partition and add GPT ti a specific disk Mac osx

----------------------------------------------------------------------------------

ssh hang after : 

debug1: expecting SSH2_MSG_KEX_ECDH_REPLY

solved using ssh -o MACs=hmac-md5  .... so adding Host :

Host nametobeused
  Hostname real.name.host
  MACs hmac-md5

to the .ssh/config file 

----------------------------------------------------------------------------------

rename files with unusual characters (i.e. spaces );

   find -name "* *" -type f | rename 's/ /_/g'
   find -name "*(*" -type f | rename 's/\(//g'


----------------------------------------------------------------------------------

Extract audio track from MKV (OPUS) to mp3:

fot name in *.mkv 
do 
  export filename=$(basename "$name")
  export extension="${filename##*.}"
  export base="${filename%.*}"

  echo $base  

  export trackn=$(mkvinfo ${base}.mkv | grep "Track type" | grep -n "audio" | cut -d ":" -f1)
  export audiotrackn=$(echo "${trackn} - 1" | bc)
  echo "track number: " $audiotrackn
  mkvextract tracks ${base}.mkv ${audiotrackn}:${base}.opus
  opusdec ${base}.opus ${base}.wav
  ffmpeg -i ${base}.wav ${base}.mp3 
  rm -f ${base}.opus ${base}.wav
done

----------------------------------------------------------------------------------

original post here: https://ubuntuforums.org/showthread.php?t=2291335&p=13341757#post13341757

not sure turn off windows fast start-up necessary
for sure not necessary disable Secure Boot in bios in my case 
a lot of advice stress the importance of this

I try to recap my solving (for computer laptop acer E5-571-57H1)
(after installed xubuntu)

turn on and press F2, bios come up (mine called InsydeH20 setup utility rev. 5.0)
go to page Security
go to "Set Supervisor Password" press ENTER (I set pass "a")
go to "Select an UEFI file as trusted for executing:" press ENTER
a new page appear with listed:
HDD0
HDD0

press ENTER on the first HDD0 and see if a sub list with the name "" comes up (in my case did not show  but: recycle bin and system volume info)
press ENTER on the second HDD0 and see if a sub list with  comes up (in my case showed  and )
press ENTER on , new list comes
press ENTER on, new list comes with:
shimx64.efi
grubx64.efi
MokManager.efi

press enter on each one and give them a for you recognizable name (I used "xubuntushimx64efi", "xubuntugrubx64efi", "xubuntuMokManagerefi")
and press Yes

save and exit

go back in bios f2

go to "Set Supervisor Password" and set pass to nill-blank (you want to eliminate a not necessary password that you could forget...)

----------------------------------------------------------------------------------

mount an LVM volumes stored in a file :

# losetup /dev/loop0  ./wserver.img

# fdisk -u -l /dev/loop0
Disk /dev/loop0: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0003ac18

Device       Boot   Start      End  Sectors  Size Id Type
/dev/loop0p1 *       2048  1026047  1024000  500M 83 Linux
/dev/loop0p2      1026048 41943039 40916992 19.5G 8e Linux LVM

we are interested in the second molume so:

512 * 1026048 = 525336576 (thata is sector size * Start sector of Linux LVM)

# losetup -d /dev/loop0

and:

# losetup /dev/loop0 ./wserver.img  -o 525336576
# fdisk -u -l /dev/loop0
Disk /dev/loop0: 19.5 GiB, 20949499904 bytes, 40916992 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

# lvm pvscan
  PV /dev/loop0     VG vg_www-thch     lvm2 [19.50 GiB / 0    free]
  PV /dev/md126p2   VG fedora          lvm2 [921.51 GiB / 0    free]
  Total: 2 [941.01 GiB] / in use: 2 [941.01 GiB] / in no VG: 0 [0   ]

# lvm vgchange -ay
  2 logical volume(s) in volume group "vg_www-thch" now active

# mount /dev/mapper/vg_www--thch-lv_root /mnt/ext

so the filesystem is now mounted in /mnt/ext 

----------------------------------------------------------------------------------

run a remote X locally:

Xephyr -ac -screen 1280x1024 -br -reset -terminate -resizeable :1 
export DISPLAY=:1
pekwm  

and so on ...

----------------------------------------------------------------------------------


[Home] [CV and Research] [Any Other Business] [Where Contact Info] [Lecture Notes]