how-to_

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

Move Google Keep notes between 2 Google accounts

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
  1. Select a single note from account A
  2. Share the note with the B account
  3. Do this recursively for each note you need to move
  4. In the B account (after a reload) select all newly shared notes and make a copy (function accessible from the top right three dots)
  5. In account A select all shared notes and delete them (function accessible from the top right three dots)
  6. Reload notes in B account

Customizzazioni Debian Linux per Consip Acer TravelMate P236-M-5789

posted Dec 2, 2016, 2:38 AM by Daniele Albrizio   [ updated Dec 2, 2016, 2:47 AM ]

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

Extract matching packets from freeRADIUS radius accounting detail

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

IPv6 l337 subnetting

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
...

Keyboard input from serial RS232 barcode scanners or badge (magnetic card) readers

posted Mar 13, 2014, 7:52 AM by Daniele Albrizio   [ updated Mar 13, 2014, 7:58 AM ]

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).

Google Earth wrong coordinates (misplacing search result)

posted Dec 11, 2013, 2:50 PM by Daniele Albrizio   [ updated Dec 11, 2013, 2:52 PM ]

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

Keyboard Layout not working?

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.

Enable IPv6 Accounting in FreeRADUIUS

posted Nov 26, 2013, 5:12 AM by Daniele Albrizio   [ updated Nov 26, 2013, 5:16 AM ]

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, \
...


FreeRADIUS Acct-Unique-Session-Id fix

posted Nov 22, 2012, 1:14 AM by Daniele Albrizio   [ updated Nov 22, 2012, 1:15 AM ]

Some WLCs (wireless lan controllers) use the same session ID tracking for a session across
multiple 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" }

Patch to Mass Mail Wordpress Plugin to support special characters and quotes

posted Nov 5, 2012, 2:36 PM by Daniele Albrizio

9c9,10

---
>
> Version: 1.1 Modified by Daniele Albrizio 20121106 - Added utf8 decoding support
78,79c79,80
<   $subject=$_POST['subj'];
<   $messagesend=$_POST['message'];
---
>   $subject=stripslashes($_POST['subj']);
>   $messagesend=utf8_decode(stripslashes($_POST['message']));
84c85
<         mail($mailto, $subject, $messagesend , "From:".$fromadmin."\nReply-To:".$fromadmin."\n");
---
>         mail($mailto, "$subject", "$messagesend" , "From:".$fromadmin."\nReply-To:".$fromadmin."\n");
180c181
< ?>
\ No newline at end of file
---

1-10 of 34

Comments