db2 doesn't start due to file permissions


So if you ever have a goofy admin of your db2 instance who decides to do a "chown -R instname:instgrp /home/instname". Then db2 refuses to start or do anything due to bad permissions, you're in a pickle. The best way out of that jar is using db2 instance upgrade command. It resets all the permissions. "db2iupdt instname"

UAC to Plain English in JavaScript

So I wrote this quick javascript code to use in IBM's SDI (TDI/IDI). When querying the microsoft AD for userAccountControl you will get a decimal equivalent of a hex value to tell you what bits in the account is activated (e.g.: 512, 544, etc.) To convert this into plain english the following code does a pretty good job.

function checkUAC(uac) {
  var flags = [
    [0x0001, 'SCRIPT'],
    [0x0002, 'ACCOUNTDISABLE'],
    [0x0008, 'HOMEDIR_REQUIRED'],
    [0x0010, 'LOCKOUT'],
    [0x0020, 'PASSWD_NOTREQD'],
    [0x0040, 'PASSWD_CANT_CHANGE'],
    [0x0080, 'ENCRYPTED_TEXT_PWD_ALLOWED'],
    [0x0100, 'TEMP_DUPLICATE_ACCOUNT'],
    [0x0200, 'NORMAL_ACCOUNT'],
    [0x0800, 'INTERDOMAIN_TRUST_ACCOUNT'],
    [0x1000, 'WORKSTATION_TRUST_ACCOUNT'],
    [0x2000, 'SERVER_TRUST_ACCOUNT'],
    [0x10000, 'DONT_EXPIRE_PASSWORD'],
    [0x20000, 'MNS_LOGON_ACCOUNT'],
    [0x40000, 'SMARTCARD_REQUIRED'],
    [0x80000, 'TRUSTED_FOR_DELEGATION'],
    [0x100000, 'NOT_DELEGATED'],
    [0x200000, 'USE_DES_KEY_ONLY'],
    [0x400000, 'DONT_REQ_PREAUTH'],
    [0x800000, 'PASSWORD_EXPIRED'],
    [0x1000000, 'TRUSTED_TO_AUTH_FOR_DELEGATION'],
    [0x04000000, 'PARTIAL_SECRETS_ACCOUNT']
  ];

  var response = "";

  for (var i=0; i<flags.length; i++) {
        if ((parseInt(uac) | flags[i][0]) === parseInt(uac)) {
      response = response + (flags[i][1] + " ("+uac+") ");
    }
  }

  return response;
}

Google Chrome's Profile Manager

I use multiple profiles on the OS/X to manage various clients' working environments and settings, including my own personal profile. I've been doing this on Linux just fine with the command line args ".desktop" shortcut files.
After some brief research, and to remember this in future, on OS/X it's as simple as creating a shortcut to the following command:

open /Applications/Google\ Chrome.app --args --profile-directory="Guest Profile"

Disabling "Discover" App in KDE

So, I had done a system update in OpenSuSE, and noticed that there was a new annoying app "Discover" for KDE. Getting this uninstalled (and stay uninstalled) took a little bit of hunting and pecking, but the following worked for me.

First find out what the app is. If it's running on the machine in front of you, you can just do an xprop.


  1. run xprop and click the Discover window. Something like the following will return (with a bunch of other data): WM_CLASS(STRING) = "plasma-discover", "discover"

  2. Get the process name/ID while it's still running: ps aux |grep plasma-discover. You will see something like 'appstream://org.kde.discover.desktop'

  3. 'locate org.kde.discover.desktop' you will see '/usr/share/applications/org.kde.discover.desktop'

  4. rpm -qf /usr/share/applications/org.kde.discover.desktop to see what package controls it. In this case, it was: discover-5.12.6-lp150.2.3.1.x86_64

  5. 'sudo zypper rm discover': remove the discover app

  6. 'sudo zypper al discover': add a lock to the app, so it doesn't get installed again when you do an update

Converting lastLogonTimestamp to Javascript Date Object

I am writing this down, because this is the last time I deal with this problem over and over again, having to have to reinvent the wheel in javascript.



var last_login = "132022299384906985";
var high   = last_login.substr(0,9);
var low    = last_login.substr(9,2);
var epoch  = (((parseInt(high) - 116444736) * 100) + parseInt(low) + 10800);
var millis = epoch * 1000;
//
// Not needed since source is UTC
//
// var localMillis = millis - (60000 * new Date().getTimezoneOffset());
//
lastLogon.getFullYear() 
  + ("00" + (lastLogon.getMonth()+1)).slice(-2) 
  + ("00" + lastLogon.getDate()).slice(-2) 
  + ("00" + (lastLogon.getHours())).slice(-2) 
  + ("00"+ lastLogon.getMinutes()).slice(-2) 
  + "Z";

group id (gid) under Mac's

I rsync'd a directory and noticed that the gid 5100 was not in my Mac's /etc/group file. So I added the group using the normal method (System Preferences -> Users and Groups) and could not find a place to update the gid. I also checked /etc/group file and was at a loss.

This link helped: https://superuser.com/questions/214004/how-to-add-user-to-a-group-from-mac-os-x-command-line

Doing a quick man on dseditgroup, with the information from that post, changing a gid on a group can be done via the following command:

sudo dseditgroup -o edit -i 5100 MyNewLocalGroup

(no subject)

So I was trying to run updatedb as a normal user to create a local database for myself. Basically, since my personal files would not be in the general database, I wanted to create a "~/.locate.db" and alias locate as a custom name (e.g.: mylocate) to use that database. But I kept running into a permissions error:


joe@delljoe:~> updatedb -U /home/joe/ -l0 -o /home/joe/.locate.db 
updatedb: can not open a temporary file for `/home/joe/.locate.db'

Even running as root, would give me that error. I have spent months scouring the web, and they all point to that command being the correct command to create a local database.

I just found out apparmor was blocking the executable from reading/writing from anywhere except the system default directory.

So there are three options:
1) Disable it for mlocate completely


sudo aa-disable /usr/bin/locate
sudo aa-disable /usr/bin/updatedb
sudo mv /etc/apparmor.d/usr.bin.locate /etc/apparmor.d/usr.bin.locate.OLD
sudo mv /etc/apparmor.d/usr.bin.updatedb /etc/apparmor.d/usr.bin.updatedb.OLD
sudo touch /etc/apparmor.d/usr.bin.locate
sudo touch /etc/apparmor.d/usr.bin.updatedb



2) Tune or update /etc/apparmor.d/usr.bin.updatedb and /etc/appmarmor.d/usr.bin.locate to allow writing to certain locations. For example updatedb can write to /home/*/.locate.db etc. This is recommended for production multi-user environments. (I am just using my laptop. And I am lazy)

3) Disable apparmor completely for dev envs

Volume buttons on LG phones

So, instead of butt dialing, I ended up butt photographing or butt taking QuickNotes+. 

The volume up and down buttons can be shortcuts to the QuickNotes+ (up) or the camera (down) by double clicking them EVEN WHILE the phone is LOCKED. So annoying. 

Perhaps it's because I've been sick the last couple days, but it took forever to find out this information... to disable it just go to Settings -> General -> Shortcut Keys. Turn it off there. 

<mini-rant>

When the phone is locked... it should be locked! Nothing should activate the phone if you don't put in the passphrase/key/etc.

</mini-rant>

<mini-praise>

I still love that LG keeps the headphone jack, so I'll give them a pass on that setting to be defaulted as "on". I actually switched to LG for the headphone jack.

</mini-praise>

OP: https://www.reddit.com/r/lgg6/comments/67row0/how_to_turn_off_volume_hotkeys/

Paste into password fields that are blocked

So I find it really annoying that there are websites which block pasting of passwords.

Here's a way around it:

1) Manually (ff)

  • Start the developer tools (F12)

  • click on inspector

  • click on the arrow next to the inspector

  • click on  the password field (to highlight the code)

  • find and remove "onpaste=false"

2) Automatically, each time... (ff)

  • Go to the about://config

  • Enter "dom.events.clipboardevents.enabled" and switch it to false

3) Automatically, each time (Chrome)

  • Use the "Don't F*ck With Paste" extension (with the "u" when searching for it)

oggenc settings with various WAV input files

So I was trying to encode a WAV file into Ogg Vorbis format. I kept getting the following error:

Skipping chunk of type "", length 0
Skipping chunk of type "", length 1635017060
Warning: Unexpected EOF in reading WAV header
ERROR: Input file "FOOBAR.WAV" is not a supported format

I checked the encoding:

> sndfile-info ./FOOBAR.WAV
========================================
File : FOOBAR.WAV
Length : 18391552
RIFF : 18391544
WAVE
fmt  : 484
  Format        : 0x1 => WAVE_FORMAT_PCM
  Channels      : 2
Sample Rate   : 48000
  Block Align   : 4
  Bit Width     : 16
  Bytes/sec     : 192000
data : 18391040
End

----------------------------------------
Sample Rate : 48000
Frames      : 4597760
Channels    : 2
Format      : 0x00010002
Sections    : 1
Seekable    : TRUE
Duration    : 00:01:35.787
Signal Max  : 18887 (-4.79 dB)

Oggenc assumes that the input will be 44.1k, since this is 48k, we need to tell oggenc to expect a 48k:

> oggenc -b 128 -r -R 48000 -o foobar.ogg FOOBAR.WAV
Encoding "FOOBAR.WAV" to
         "foobar.ogg"
at approximate bitrate 128 kbps (VBR encoding enabled)
        Encoding [ 0m01s so far] -

Done encoding file "foobar.ogg"

        File length:  1m 35.0s
        Elapsed time: 0m 01.4s
        Rate:         70.5000
        Average bitrate: 108.4 kb/s