Saturday, December 02, 2017

Windows could not complete the installation. To install windows on this computer restart the installation

SHIFT-F10 to bring up command prompt.
cd c:\windows\system32\oobe
Make a generic account and password. 
Hit finish (if it requests a product key and you have one, enter it now.  if OEM/No key required, just finish). 
Set time/date. 

Thursday, November 02, 2017

Extend LVM with a new disk

cat /proc/partitions - note the un-partitioned drive (ex: there is a /dev/xvdX but not /dev/xvdX1) 
cfdisk /dev/xvdX - create new partition, type 8e (LVM) 
pvcreate /dev/xvdX1 
vgdisplay  - note the VG name
vgextend vg_bkp_vol_1 /dev/xvdX1 
lvdisplay  - note the LV path
lvextend /dev/vg_bkp_vol_1/lv_bkp_vol_1 /dev/xvdX1 
resize2fs /dev/vg_bkp_vol_1/lv_bkp_vol_1 

Monday, October 16, 2017


Right on time!

Tuesday, September 05, 2017

Deploy .pfx cert embedded in script (a sort of 'cat << EOF' for windows)

@echo off
:: In order to prepare the certificate please run
:: 'certutil -encode the_pfx_cert base_64_cert`
:: then paste the base_64_cert in the section below
:: Please note that the certificate password has to be given as start paramater to this script!
:: (eq: "cert-inst.bat S3cr3tPassw0rd")

:: If the cert was already installed, exit
If %errorlevel%==0 goto :eof

:: define the temp name of the extracted cert
set extractedfile=%temp%\extract-%random%.txt

:: set the password needed to decode the cert
set certpasswd=%~1

:: separate the cert from this script
call:extractembedded embeddedfile %extractedfile%

:: process the extracted file
certutil -decode %extractedfile% %extractedfile%.pfx

certutil -f -user -p %certpasswd% -importpfx %extractedfile%.pfx

:: clean-up
::del %extractedfile% %extractedfile%.pfx

:: leave a trace in the registry, so the cert will not be installed again and again
REG ADD HKCU\SOFTWARE\neXt /v CertInstalled /t REG_DWORD /d 1

:: clean exit
exit /b

:: begin of the embed cert & extraction procedure
:: After the next line, please paste the "base_64_cert" created by certutil -encode
:: before the previous line you can find the end of the "base_64_cert"

:: cert extraction procedure
setlocal EnableDelayedExpansion
set embedbegin=goto:%~1
set embedend=:%~1
set embedcert=%~2
if exist %embedcert% del %embedcert%
set tmprndfile=%temp%\%random%.%random%
findstr /n ^^ "%~f0" > %tmprndfile%
call :seekembed < %tmprndfile%
del %tmprndfile%
exit /B
set oneline=:eof
set /P oneline=
if !oneline! == :eof goto nostart
set oneline=!oneline:*:=!
if not !oneline! == %embedbegin% goto seekembed
set oneline=:eof
set /P oneline=
if !oneline! == :eof goto nostop
set oneline=!oneline:*:=!
if !oneline! == %embedend% goto :eof
echo/!oneline!>> %embedcert%
goto getline
echo Error finding start delimiter %embedbegin%
goto :eof
echo Error finding stop delimiter %embedend%
goto :eof

Tuesday, August 01, 2017

Boot from grub2 rescue prompt

grub rescue> set prefix=(hd0,1)/boot/grub2
grub rescue> set root=(hd0,1)
grub rescue> insmod normal
grub rescue> normal
grub rescue> insmod linux
grub rescue> linux /boot/vmlinuz root=/dev/sda1
grub rescue> initrd /boot/initrd.img
grub rescue> boot

Friday, June 02, 2017

Phone extension that rings multiple external numbers (CCME Asterisk)

Skip to end of metadata
In this example we want to ring all the external numbers of a few people only by dialing extension 3331.
1: Connect to CCME and create a new dial-peer:
dial-peer voice 3331 voip
 description External Emergency Responders
 destination-pattern 3331$
 session protocol sipv2
 session target ipv4:192.168.0.XXX #(the Asterisk box)
 dtmf-relay rtp-nte cisco-rtp
 codec g711ulaw
 no vad
2: Connect to the asterisk server and add the extension in the default [incoming_context] in /etc/asterisk/extensions.conf: (192.168.0.YYY is the outgoing trunk)
exten => 3331,1,Dial(SIP/5145555555@192.168.0.YYY&SIP/51455555519@192.168.0.YYY&SIP/5145555552@192.168.0.YYY&SIP/5145555553@192.168.0.YYY&SIP/5145555554@192.168.0.YYY&SIP/5145555555@192.168.0.YYY)
exten => 3331,n,Hangup
3: Reload asterisk config and test the extension (smile)

Monday, May 01, 2017

Limit number of unix logins


session=`ps -ef | grep '\-sh' | grep $USER | grep -v grep`
number=`echo $session | wc -l`

if [ $number -ge $limit ]; then
echo "No more logins / Il n'y a plus de login. You are already logged as:
$session "

sleep 5
exit 0

Monday, April 03, 2017

Forward all emails from one sendmail to another

- in change Djdomain.tld to something like Dj_subdomain.domain.tld Do the same thing for DMdomain.tld
- in the same look for Fw or Fw-o and check the file it refers to (usually /usr/lib/mail/local-host-names); in that file remove the line stating "domain.tld" (in fact, remove everything, leave just _subdomain.domain.tld there), that way sendmail will know that it is not the default destination for the @domain.tld

- if necessary, create /home/$username/.forward (chmod 600, chown $username:$group) and put the right info in it

Wednesday, March 01, 2017

Install mc on sco sysV unix

curl |bzcat |tar xvf -
(there is a copy of that archive in my /update directory)

in .profile add PATH=$PATH:/usr/local/bin:/usr/local/sbin