Sunday, November 15, 2015

Virtualbox centos: Device eth0 does not seem to be present

If, when copying a VM from one computer to another one, you face this error:
service network restart
...
Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization.

Then ensure first that /etc/sysconfig/network-scripts/ifcfg-eth0 has the same MAC address as in Virtualbox network settings, plus
rm /etc/udev/rules.d/70-persistent-net.rules
and reboot

Cisco AnyConnect - Adding Multiple VPN Devices to the Client

See http://www.petenetlive.com/KB/Article/0001011.htm
  • Windows: vi C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\profile\Profile.xml
  • MacOS: vi /opt/cisco/anyconnect/profile/Profile.xml

 
  false
  true
  false
  All
  false
  Native
  true
  12
  false
  true
  true
  true
  true
   DisconnectOnSuspend
  
  true
  Automatic
  SingleLocalLogon
  LocalUsersOnly
  false
  Disable
   
  
  false
  false
   20
   4
  
  false
  
 
 
  
   My entry #1
   my_entry1.com
  
  
   My entry #2
   my_entry2.com
  
 

Wednesday, November 4, 2015

PostgreSQL: epoch to date

select to_timestamp(1446631729) at time zone 'UTC';

Monday, November 2, 2015

Git: show files not yet pushed

git diff --numstat origin/master

Monday, October 26, 2015

Git: cancel staged file update

With git log check which commit is one prior the update. Then you can reset it using:
git reset  filename
git checkout filename

Git: cancel merge

With git log check which commit is one prior the merge. Then you can reset it using:
git reset --hard commit_sha

Saturday, October 17, 2015

OSX: use Clover Configurator

First mount EFI partition:
Identify EFI device
diskutil list
Then mount device, e.g.
mkdir /Volumes/EFI
sudo mount_msdos /dev/disk0s1 /Volumes/EFI
Then select /Volumes/EFI/EFI/CLOVER/config.plist in Clover configurator

OSX: Errors in audio_cloverALC-110_v1.0h

See https://github.com/toleda/audio_CloverALC/issues/43

OSX: Clover install on El Capitan

How To Install OS X Yosemite Using Clover

Wednesday, October 14, 2015

PostgreSQL: compile pgloader

Compile SBCL with core compression support:
git clone git://git.code.sf.net/p/sbcl/sbcl
cd sbcl
./make.sh --with-sb-core-compression --with-sb-thread
sudo ./install.sh

Compile pgloader:
git clone https://github.com/dimitri/pgloader.git
cd pgloader
make
sudo cp ./build/bin/pgloader /usr/bin

Tuesday, October 13, 2015

PostgreSQL: generate create table SQL

pg_dump -t 'my_schema.my_table' --schema-only

Tuesday, September 29, 2015

PostgreSQL: interval to number of days

select extract(epoch from my_interval)/86400;

Wednesday, September 23, 2015

Postgresql: import export of data

Export
copy (select * from shared_db.dt_process where process_name = 'AM_PARTITION') to '/tmp/shared_db__dt_process.csv' delimiter ',' csv header;
Import
copy shared_db.dt_process from '/tmp/shared_db__dt_process.csv';

Tuesday, September 1, 2015

CentOS: install Oracle JDK

  • Download JDK from download.oracle.com
  • cd /usr/local/share
    tar xvfz /media/host/jdk-8u60-linux-x64.tar.gz
    ln -s jdk1.8.0_60 jdk
  • alternatives --install /usr/bin/java java /usr/local/share/jdk/bin/java 1
    alternatives --install /usr/bin/javac javac /usr/local/share/jdk/bin/javac 1
    alternatives --install /usr/bin/jar jar /usr/local/share/jdk/bin/jar 1

Thursday, August 27, 2015

OSX: pipe

shift + Right Alt + l

CentOS 6 VM: french Macbook keyboard under X11

setxkbmap -layout fr -model macintosh

Saturday, August 8, 2015

QNAP: add dnsomatic cronjob

Source: http://forum.qnap.com/viewtopic.php?t=12970
vi /share/CACHEDEV1_DATA/homes/dnsomatic/dnsomatic.sh
#!/bin/sh
HOSTNAME="all.dnsomatic.com"
USER="my_dnsomatic_user"
PASS="my_dnsomatic_password"
TMPFILE="/tmp/dnsomatic.oldip"
DATENOW=$(date)
 
IP=$(/sbin/curl -s http://myip.dnsomatic.com)
if [ -r "/tmp/dnsomatic.oldip" ]; then
 OLDIP=`cat /tmp/dnsomatic.oldip`
 if [ "$OLDIP" = "$IP" ]; then
  echo "IPs match; no update"
  exit 0
 else
  RETURN=$(/sbin/curl -s -m 60 -k -u ${USER}:${PASS} https://updates.dnsomatic.com/nic/update?hostname=${HOSTNAME}&myip=$IP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG)
  echo "Return message of DNS-O-Matic : " $RETURN
  echo $RETURN | grep "good" > /dev/null 2>&1
  if [ "$?" -eq "0" ]; then
   echo $IP > /tmp/dnsomatic.oldip
  else
   echo "" > /tmp/dnsomatic.oldip
  fi
 fi
else
 touch /tmp/dnsomatic.oldip
fi
Then update crontab to run it once an hour:
 vi /etc/config/crontab
0 */1 * * * /share/CACHEDEV1_DATA/homes/dnsomatic/dnsomatic.sh >/tmp/dnsomatic.log 2>&1
crontab /etc/config/crontab
/etc/init.d/crond.sh restart

Thursday, July 9, 2015

PostgreSQL: copy table

select * into archive.radius_cdr_pdp_p2015_07_09 from ods_db.radiucdr_pdp_p2015_07_09;