Friday, December 11, 2020

HOWTO Unmap Ctrl-Alt-End in Xfce on Debian

Using Remote Desktop (via Citrix) to access a Windows server, and need to press Ctrl-Alt-End to send Ctrl-Alt-Del to change your password?

By default, in Xfce Ctrl-Alt-End is mapped to

/xfwm4/default/<Primary><Alt>End           move_window_next_workspace_key

which stops Citrix from sending it.

To undo this mapping, you can go to:

Start / Settings / Settings Editor

Then on the left go to

xfce4-keyboard-shortcuts

Find:

xfwm4 / default / <Primary><Alt>End String move_window_next_workspace_key

And possibly:

xfwm4 / custom / <Primary><Alt>End String move_window_next_workspace_key

Select it and choose Reset

Also see:

https://askubuntu.com/questions/540797/disable-controlaltend


Friday, June 19, 2020

Fixes for issues with Citrix Workspace on Linux

This is for /etc/icaclient/config/All_Regions.ini

This is in:

;
; These settings control the keyboard settings
;
[Virtual Channels\Keyboard]
;
; To enable alt-tab in remote machine
; https://discussions.citrix.com/topic/403094-alttab-will-not-work-on-citrix-workspace-for-linux-to-windows/
; TransparentKeyPassthrough=Remote
;
TransparentKeyPassthrough=Remote
;
; Remote losing keyboard but not mouse after screensaver
; https://discussions.citrix.com/topic/247676-linux-client-keyboard-stops-responding-mouse-unaffected/
; UseLocalIM=False
;
UseLocalIM=False

Tuesday, July 09, 2019

Changing owner of mounted NFS filesystem.

Mounting an NFS filesystem from Windows on Linux.

The user:group of the files was being set to nobody:nobody

To override this, you can use:

rw,vers=3

in your options in /etc/fstab

Found this on:

https://serverfault.com/questions/520276/nfs-user-mapping

Using mount we could see that the mount options were defaulting to nfsv4 (which doesn't support changing the user? - it certainly doesn't offer setting the user in the available mount options.)

Wednesday, February 13, 2019

Python configure on Debian: compiling and linking against OpenSSL doesn't work

If you are running ./configure on a new download of Python and you get this:

checking whether compiling and linking against OpenSSL works... no

And you already have openssl installed...

Make test after a build returns:

Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381

just do:

sudo apt-get install libssl-dev

Now when you run ./configure you should see:

checking whether compiling and linking against OpenSSL works... yes
checking for X509_VERIFY_PARAM_set1_host in libssl... yes
checking for --with-ssl-default-suites... python

Thursday, January 24, 2019

Treat period as a word boundary in vim

If cw in vim is selecting past '.' to the next whitespace or non-alpha (for which I would usually use cW)

If you do set you may find:

iskeyword=@,48-57,_,192-255,.

If you do :set iskeyword-=.; it will remove it.

NB: This is probably file-type specfic (e.g. in RedHat while editing a .sh file, but not when invoking vim with no file)

If you don't want to set this globally, you can use :setlocal for certain filetypes (in ~/.vim/after/ftplugin/.vim)

Source: https://stackoverflow.com/questions/19571022/how-can-i-include-periods-when-selecting-a-word-in-vim

Monday, September 17, 2018

Simple bash "UUID" generator

If you need a UUID-like string in a bash script, e.g. for the message part boundary in an email, this is probably about as simple as you can get:

#!/bin/bash

MD5SUM=/usr/local/gnu/bin/md5sum
DATE=/usr/local/gnu/bin/date

MD5=$($DATE +'%s.%N'|$MD5SUM)

B1=${MD5:0:8};B2=${MD5:8:4};B3=${MD5:12:4};B4=${MD5:16:4};B5=${MD5:20:12}

BOUNDARY="$B1-$B2-$B3-$B4-$B5"

Wednesday, August 15, 2018

Using lftp to mirror sub directories.

lftp can nicely mirror sub directories... just do: mirror --use-pget-n=5

Wednesday, May 30, 2018

perl5/perlbrew/etc/bashrc: line 103: perlbrew: command not found

If you're getting /path/to/perl5/perlbrew/etc/bashrc: line 103: perlbrew: command not found Try checking to see you don't have a $HOME/.perlbrew/init file which points to an old version of perlbrew which has been deleted.

Say no to whichcraft

Interesting and useful history and alternatives to which command https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then/85250#85250

Tuesday, May 15, 2018

Lazy way to resort a table in SQL

When you have a query and you want to sort the output but the query is too complex to see what to sort on. (say your output column isn't a selected column, but rather generated data)

select
case
        when substring(t1.some_column, 1, 1) = '#' then rtrim(t1.some_column)
        when 'some_group' in ('group_a', 'group_b', 'group_c', 'group_d', 'group_e') then  '#' + rtrim(t1.some_column)
        else rtrim(t1.some_column)
end as 'op_col_1',
case
 when t1.ip_col_1 = 'a' then 'ant'
 when t1.ip_col_1 = 'b' then 'beetle'
 when t1.ip_col_1 = 'c' then 'centipede'
 else 'no_bugs'
end as 'op_col_2',
from table_one t1

You can wrap the whole lot in brackets and sort by the column order or the generated name:

select * from (
select
case
        when substring(t1.some_column, 1, 1) = '#' then rtrim(t1.some_column)
        when 'some_group' in ('group_a', 'group_b', 'group_c', 'group_d', 'group_e') then  '#' + rtrim(t1.some_column)
        else rtrim(t1.some_column)
end as 'op_col_1',
case
 when t1.ip_col_1 = 'a' then 'ant'
 when t1.ip_col_1 = 'b' then 'beetle'
 when t1.ip_col_1 = 'c' then 'centipede'
 else 'no_bugs'
end as 'op_col_2',
from table_one t1
) query_out
where op_col_1 like 'blah%'
order by op_col_2
or
order by 2

Thanks Chris!

Tuesday, April 24, 2018

Sybase column name and datatype of all columns in a table

SELECT syscolumns.name, systypes.name FROM sysobjects
JOIN syscolumns ON sysobjects.id = syscolumns.id
JOIN systypes ON systypes.type = syscolumns.type
AND systypes.usertype = syscolumns.usertype
WHERE sysobjects.name LIKE 'my_table'

https://stackoverflow.com/a/28940121/224625

Tuesday, October 31, 2017

Show seconds in ls -l output on Solaris 10

If you need to show the seconds (and year) in the output of ls -l on Solaris:


$ ls -le /path/to/file

Friday, August 26, 2016

Ardour4, JACK, ALSA... Rosegarden, qsynth etc...

When you install Ardour on a fresh Debian install you will probably find that the sound isn't working.

Here's what I did to get it going.

sudo aptitude install ardour

I also installed these.

sudo aptitude install Qtractor
sudo aptitude install audacity

I installed these 2 to convert mp3s to ogg so I could import them.
Qtractor lets you import mp3 but ardour doesn't

sudo aptitude install ffmpeg
sudo aptitude install dir2ogg


To control/configure jack....

sudo aptitude install jack-tools qjackctl

This lets JACK and Pulse talk to each other, otherwise they lock each other out.

sudo aptitude install pulseaudio-module-jack

I'm not sure if I needed this, but this was one step:

sudo aptitude install linux-image-4.6.0-1-rt-amd64

This was the key: https://ubuntuforums.org/archive/index.php/t-986080.html


I would bet you need to look at the Ardour mixer and route the Main Output channel to your soundcard outs.

In Ardour press Alt+M (to view the mixer) then at the bottom of the Main Output strip there should be a button labeled Output - click that, then add your soundcard outs to the appropriate channels in the dialog box that pops up.

There shouldn't be any issue with the format of your wav file as ardour will resample things for you (at a better quality rate than ProTools actually).

This issue could also stem from you not having JACK configured correctly. In Ardour's open dialog, if you haven't already started the JACK audio server, there will be a tab that says audio setup - this is Ardour's own JACK startup script. It should work fine by default, but you should probably read up on JACK and qJackCtl.

To get Rosegarden going I used this page: http://gauthampai.livejournal.com/62383.html
The key to that was installing the soundfont, and qsynth.

Once you've got it configured and working, you also need to start qsynth before Rosegarden and have it running the whole time Rosegarden is. If you restart qsynth you'll probably need to restart Rosegarden for it to reconnect.


Tuesday, February 02, 2016

Installing 7-Zip plugin in MobaXterm

I like MobaXterm http://mobaxterm.mobatek.net/

I like 7-Zip http://p7zip.sourceforge.net/
(In my previous version of this How-To I used 7-Zip for Windows from http://www.7-zip.org/ ) to open the downloaded archive, but now you can do it all from within mobaxterm.

To get 7-Zip working in MobaXterm I downloaded the 7-Zip package from a cygwin mirror... (find your closest one at https://cygwin.com/mirrors.html )

You can find the current version with this:
wget -qO- http://mirrors.kernel.org/sourceware/cygwin/x86/release/p7zip/ | sed -e 's/<[^>]*>//g'
Then download the version you want. e.g.:
wget -N http://mirrors.kernel.org/sourceware/cygwin/x86/release/p7zip/p7zip-15.14-2.tar.xz
You should now have this file in your current directory:
-rwxrwx---    1 Administ UsersGrp   1039440 Apr  5 05:12 p7zip-15.14-2.tar.xz
You can unpack the tar.xz with gnu tar:
tar xvf p7zip-15.14-2.tar.xz
You can then create the package using the p7zip from the unpacked tar file:
usr/lib/p7zip/7za.exe a p7zip.mxt3 -tZIP usr
Finally move the file you have created to C:\Program Files (x86)\Mobatek\MobaXterm Personal Edition
You will probably need to do that step from outside MobaXterm otherwise you won't have permission to write to the directory.

Then restart MobaXterm.

job done.

If you don't know where to find your home directory from Windows you can open it in Windows Explorer by doing:

$ open $PWD

from the command line in your home directory.


NB:
If you have trouble with the step creating the mxt3 file you can do it via Windows too:
Originally I opened the directory it created ( p7zip-15.09-1 ) in Windows Explorer and right clicked on the usr directory and chose 7-Zip -> Add to "usr.zip" (NB: Choose usr.zip, not usr.7z here)
This created a .zip file containing the usr directory.

I then renamed usr.zip to p7zip.mxt3

Wednesday, August 13, 2014

/etc/acct/holidays

In /var/adm/messages on Solaris:

Aug 13 02:30:16 hostname adm: [ID 702911 daemon.notice]
Aug 13 02:30:16 hostname last message repeated 4 times
Aug 13 02:30:16 hostname adm: [ID 702911 daemon.notice] **********  SYSTEM ACCOUNTING STARTED Wed Aug 13 02:30:16 BST 2014  **********
Aug 13 02:30:16 hostname adm: [ID 702911 daemon.notice]
Aug 13 02:30:16 hostname last message repeated 4 times
Aug 13 02:30:16 hostname adm: [ID 702911 daemon.error]
Aug 13 02:30:16 hostname last message repeated 1 time
Aug 13 02:30:16 hostname adm: [ID 702911 daemon.error] ************ ACCT ERRORS : see  /var/adm/acct/nite/log********
Aug 13 02:30:16 hostname adm: [ID 702911 daemon.error]
Aug 13 02:30:16 hostname last message repeated 1 time

In /var/adm/acct/nite/log

***UPDATE /etc/acct/holidays WITH NEW HOLIDAYS***

Update /etc/acct/holidays to have 2037 for the year.

$ cat /etc/acct/holidays
* @(#)holidays  January 1, 2010
*
* Prime/Nonprime Table for UNIX Accounting System
*
* Curr  Prime   Non-Prime
* Year  Start   Start
*
  2037  0800    1800
*
* only the first column (month/day) is significiant.
*
* month/day     Company
*               Holiday
*
1/1             New Years Day
12/25           Christmas

https://hg.openindiana.org/upstream/illumos/illumos-gate/raw-file/afe390b9f1e0/usr/src/cmd/acct/lib/pnpsplit.c

/*
 * inithol - read from an ascii file and initialize the "thisyear"
 * variable, the times that prime and non-prime start, and the
 * holidays array.
 */
int
inithol()
{
...
 /* validate year */
 if(thisyear < 1970 || thisyear > 2037) {
  fprintf(stderr, "pnpsplit: invalid year: %d\n",
   thisyear);
  errflag++;
  break;
 }
...
}

Thursday, July 17, 2014

To replace text in vim with line number

e.g.:
mv file_abc.jpg pic.XX.jpg
mv random.jpg   pic.XX.jpg
mv other.jpg    pic.XX.jpg
mv name.jpg     pic.XX.jpg
If you do this:
:%s/XX/\=line(".")/

Tuesday, July 01, 2014

Make SSH ignore SSH key

Make SSH ignore your SSH key, not prompt for a passphrase, only use password:

$ ssh -o PreferredAuthentications=keyboard-interactive -o PubkeyAuthentication=no destination.host

Wednesday, May 28, 2014

find things...

Find files that are not world readable and make them readable:

sudo find . -type f \! -perm -4 -exec chmod o+r {} +

Find files that are not group readable

find . -type f \! -perm -40 -ls

Find files that are group writable

find . -type f -perm -20 -ls

Find files that are world writable

find . -type f -perm -2 -ls

Wednesday, May 14, 2014

To find if a Solaris host is running on an LDom

If the file /usr/sbin/virtinfo exists, run:

$ /usr/sbin/virtinfo -a

If you run it as root it will also tell you the hostname of the Control domain and the Chassis serial#.

Thursday, November 14, 2013

list to csv...

ls | paste -s -d'%' - | sed 's/\(^\|$\)/"/g;s/%/","/g'