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!