This is a doubty useful tips-'n-tricks blog page. Feel free to use and spread the following contents.
There is also a dedicated section for
posted Oct 4, 2023 by Daniele Albrizio
sed -z 's/\n/ /g'
posted Sep 4, 2023 by Daniele Albrizio
can be found in
.config/evolution/accels
posted Aug 9, 2023 by Daniele Albrizio
ssh -t user@server 'whatever command' >local_file
POSIX explicitly allows this:
/dev/tty
In each process, a synonym for the controlling terminal associated with the process group of that process, if any. It is useful for programs or shell procedures that wish to be sure of writing messages to or reading data from the terminal no matter how output has been redirected. […]
With -t the default stdin, stdout and stderr (and /dev/tty) of the remote command point to the same pseudo-terminal; now stdout, stderr and whatever the remote command writes to its /dev/tty get combined into a single stream the local ssh prints to its (local) stdout.
Credits to Kamil Maciorowski
posted Lug 31, 2023 by Daniele Albrizio
view -c 'set noautoread' /var/log/syslog
posted Sep 2, 2020, 5:33 AM by Daniele Albrizio
systemd-resolve --flush-caches
Tested on Ubuntu 18.04.5 LTS
posted Aug 5, 2017, 3:23 AM by Daniele Albrizio [ updated Aug 5, 2017, 3:24 AM]
Easy but not quite fast way to move all or some note from google account A to Google account B
posted Dec 2, 2016, 2:38 AM by Daniele Albrizio
Il touchpad ha bisogno di qualche customizzazione da mettere in
/etc/X11/xorg.conf.d/synaptics.conf
Allego un esempio del file che uso io ma sono parametri assolutamente personalizzabili.
Section "InputClass"
Identifier "Touchpad" # required
MatchIsTouchpad "yes" # required
Driver "synaptics" # required
Option "MinSpeed" "0.1"
Option "MaxSpeed" "0.8"
Option "AccelFactor" "0.075"
Option "TapButton1" "1"
Option "TapButton2" "2" # multitouch
Option "TapButton3" "3" # multitouch
Option "VertTwoFingerScroll" "1" # multitouch
Option "HorizTwoFingerScroll" "1" # multitouch
Option "VertEdgeScroll" "1"
Option "HorizEdgeScroll" "1"
Option "CoastingSpeed" "4"
Option "CornerCoasting" "1"
Option "CircularScrolling" "1"
Option "CircScrollTrigger" "7"
Option "EdgeMotionUseAlways" "1"
Option "LBCornerButton" "8" # browser "back" btn
Option "RBCornerButton" "9" # browser "forward" btn
EndSection
Per ulteriori informazioni sui parametri basta usare il manuale del driver synaptics:
$ man synaptics
Per vederne l'effetto run-time è possibile usare i seguenti comandi
$ xinput --list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ ELAN0501:00 04F3:3010 Touchpad id=10 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ HD WebCam id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
↳ Acer WMI hotkeys id=12 [slave keyboard (3)]
$ xinput disable 10
$ xinput enable 10
posted May 20, 2016, 12:32 AM by Daniele Albrizio [ updated May 20, 2016, 12:32 AM]
Dirty but working-with-large-files script to multiline grep out interesting lines from detail files.
Usage examples:
callingstationid extraction:
$ cat detail | grepradacct "00:0e:ff:ab:cd:ef"
username extraction:
$ cat detail | grepradacct "jane@ucla.edu"
$ grepradacct "jane@ucla.edu" detail
Content of grepradacct script:
#!/bin/sh
GREPSTRING=$1
if [ $2 ]; then
echo Results in $2 >&2
cat $2 |\
awk -F'\n' 'BEGIN {RS='\n\n'; ORS='\t'; OFS='\t';} { for (i=1; i<=NF; i++) print $i } { print "\n\n" }' |\
grep -a "$GREPSTRING" |\
awk -F'\t' 'BEGIN {OFS='\n';} {print "\n" $1; for (i=2; i<=NF; i++) print "\t" $i "" }'
else
cat - |\
awk -F'\n' 'BEGIN {RS='\n\n'; ORS='\t'; OFS='\t';} { for (i=1; i<=NF; i++) print $i } { print "\n\n" }' |\
grep -a "$GREPSTRING" |\
awk -F'\t' 'BEGIN {OFS='\n';} {print "\n" $1; for (i=2; i<=NF; i++) print "\t" $i "" }'
fi
posted Oct 14, 2015, 9:12 AM by Daniele Albrizio
Searching for meaningful subnet numbers for a new IPv6 /48 range subnetting, I tried to do an automatic extraction of 4 characters (/64 subnet) word in my language that can translate somehw in an IPv6 l337 address.
So I searched for and downloaded my language wordlist and then using the following command:
$ cat italian_words | grep ^....$ | grep -Ev "h|k|m|p|n|u|v|w|x|y" | while read word; do echo -n "$word "; echo $word | tr gijloqrstz 9111002572; done
I gota a comprehensive list of usable terms:
... roba 20ba rogo 2090 rosa 205a rose 205e saio 5a10 sala 5a1a sale 5a1e sali 5a11 salo 5a10 sazi 5a21 scia 5c1a scie 5c1e seco 5ec0 seda 5eda sede 5ede sedi 5ed1 sedo 5ed0 sega 5e9a sego 5e90 sera 5e2a sere 5e2e ...
posted Mar 13, 2014, 7:52 AM by Daniele Albrizio
After strolling a little bit too much around google I finally found something easy dirty and useful to connect serial input to Xinput.
As it is hard to compile (dependencies, errors, a lot) I found a precompiled debian/ubuntu package here http://dl.stackfoundry.org/softwedge/
These packages are not easy to find in the net, so i decided to post them here.
All yu have to do is to type this in a terminal inside your X session. All input will be instantly available on the focused window.
softwedge -c /dev/ttyS0
Obviously substitute ttyS0
with your favourite serial emulated port such as rfcomm0
(bluetooth) or ttyUSB0
(usb serial dongle).
posted Dec 11, 2013, 2:50 PM by Daniele Albrizio
It happens that there is a bug/incompatibility between Qt libraries and Google Earth in a way that comma are interpreted as point and viceversa in locale environments where comma is used to separate decimals and point as a thousand separator. So let's reset locale settings for numbers only before starting Google Earth:
Find the bash executable of GE : in my system /opt/google/earth/free/googleearth
Just before the last line
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./googleearth-bin "$@"
put
export LC_NUMERIC=us_US.UTF-8
Re-execute GE and enjoy!
Thanks to pete.dawgg for this hint
posted Dec 9, 2013, 1:50 PM by Daniele Albrizio
Tired of faulty Ubuntu UIs, I found this useful, simple and straight command to switch keyboard layout in X:
setxkbmap -layout "it"
Give it in a terminal window inside the user X session, tested with Gnome and Cinnamon desktop.
posted Nov 26, 2013, 5:12 AM by Daniele Albrizio
Postgres DB: add a column for IPv6 accounting alter table radacct add framedipv6address inet
;
This magnificent database uses the same data type for IPv4 and v6 addresses :)
FreeRADIUS: raddb/sql/postgresql/dialup.conf
add proper IPv6 lines
accounting_start_query = "INSERT INTO ${acct_table1} \
(AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, \
NASPortId, NASPortType, AcctStartTime, AcctAuthentic, \
ConnectInfo_start, CalledStationId, CallingStationId, ServiceType, \
FramedProtocol, FramedIPAddress, FramedIPv6Address, AcctStartDelay, XAscendSessionSvrKey) \
VALUES('%{Acct-Session-Id}', \
'%{Acct-Unique-Session-Id}', \
'%{SQL-User-Name}', \
NULLIF('%{Realm}', ''), \
'%{NAS-IP-Address}', \
%{%{NAS-Port}:-NULL}, \
'%{NAS-Port-Type}', \
('%S'::timestamp - '%{%{Acct-Delay-Time}:-0}'::interval), \
'%{Acct-Authentic}', \
'%{Connect-Info}', \
'%{Called-Station-Id}', \
'%{Calling-Station-Id}', \
'%{Service-Type}', \
'%{Framed-Protocol}', \
NULLIF('%{Framed-IP-Address}', '')::inet, \
NULLIF('%{Framed-IPv6-Address}', '')::inet, \
0, \
'%{X-Ascend-Session-Svr-Key}')"
accounting_update_query = "UPDATE ${acct_table1} \
SET FramedIPAddress = NULLIF('%{Framed-IP-Address}', '')::inet, \
FramedIPv6Address = NULLIF('%{Framed-IPv6-Address}', '')::inet, \
...
accounting_stop_query = "UPDATE ${acct_table2} \
...
FramedIPAddress = NULLIF('%{Framed-IP-Address}', '')::inet, \
FramedIPv6Address = NULLIF('%{Framed-IPv6-Address}', '')::inet, \
...
posted Nov 22, 2012, 1:14 AM by Daniele Albrizio
Some WLCs (wireless lan controllers) use the same session ID tracking for a session acrossmultiple access points (NAS-Port). Freeradius by default builds his session tracking using all of
User-Name
Acct-Session-Id
NAS-IP-Address
Client-IP-Address
NAS-Port
as key. This results in never finished sessions since a client moving from one access point to another does maintain the same Acct-Session-Id (provided by the WLC), but changes the Acct-Unique-Session-Id.
Example:
Radius type | Acct-Session-Id | NAS-Port | Acct-Unique-Session-Id
---------------+-----------------+----------+-----------------------
Start | A | M | X
Interim-Update | A | M | X
Interim-Update | A | N | Y
Stop | A | N | Y
To change the way FreeRADIUS buils the Acct-Unique-Session-Id I modified raddb/modules/acct_unique as follows:
#acct_unique {# key = "User-Name, Acct-Session-Id, NAS-IP-Address, Client-IP-Address, NAS-Port"#}
acct_unique { key = "User-Name, Acct-Session-Id, NAS-IP-Address, Client-IP-Address"}