Friday, February 12, 2016

Git: see only one user's commits

git lol --author='John Smith' --name-only

Tuesday, February 2, 2016

Git: cancel a git stash apply

If you haven't pushed:
git reset --hard [last_good_commit]
or if you have pushed:
git revert [last_good_commit]

Sunday, January 17, 2016

OSX: no more sleep after 10.11 to 10.11.2 upgrade

Symptoms: Apple menu | Sleep causes the monitor to sleep but not the UC anymore
Diagnosis:
centurion:~ jerome$ pmset -g assertions
2016-01-07 08:07:40 +0100 
Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   0
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  0
   PreventUserIdleSystemSleep     0
   NetworkClientActive            1
Listed by owning process:
   pid 245(cupsd): [0x0000048000110227] 00:01:13 NetworkClientActive named: "org.cups.cupsd" 
Kernel Assertions: 0x104=USB,MAGICWAKE
   id=500  level=255 0x4=USB mod=01/01/70 01:00 description=com.apple.usb.externaldevice.1d110000 owner=IOUSBHostDevice
   id=501  level=255 0x4=USB mod=01/01/70 01:00 description=com.apple.usb.externaldevice.1d113000 owner=Dell USB Keyboard Hub
   id=502  level=255 0x4=USB mod=01/01/70 01:00 description=com.apple.usb.externaldevice.1d114000 owner=Optical USB Mouse
   id=503  level=255 0x100=MAGICWAKE mod=01/01/70 01:00 description=en0 owner=en0
Idle sleep preventers: IODisplayWrangler

We can see that the culprit is cupsd, which is related to the printer driver.
Solution:
Uninstall the printer, then re-install it again and the problem is gone.

Monday, November 30, 2015

Git: check if something to pull

git remote -v update

Tuesday, November 24, 2015

PostgreSQL: see number of connections

select sum(numbackends) from pg_stat_database;

Sunday, November 15, 2015

Windows: change desktop icon size

  1. Using the left click of the mouse, click on an empty area in the desktop. This step is to make sure that there is no application selected/clicked on. 
  2. Using your keyboard, press and keep holding the CTRL button, then using your mouse wheel, roll it upward to make the icons size larger, or downward to set the icon size smaller

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;