Raspian and Media-Keys

Do you have a Keyboard with Media-Keys connected to your Raspberry PI? So do I 🙂

I’ve added following lines to my ‚lxde-pi-rc.xml‘ File in ‚/home/pi/.config/openbox‘ in the keyboard-section:

<keybind key="XF86AudioRaiseVolume">
  <action name="Execute">
    <command>amixer set PCM 250+ unmute</command>
  </action>
</keybind>
<keybind key="XF86AudioLowerVolume">
  <action name="Execute">
    <command>amixer set PCM 250- unmute</command>
  </action>
</keybind>
<keybind key="XF86AudioMute">
  <action name="Execute">
    <command>amixer set PCM toggle</command>
  </action>
</keybind>

Works like a charm!

Münchausen Zahlen

Dieses Posting ist furchtbar inspiriert durch einen Eintrag von diesem Blog: https://zach.se/munchausen-numbers-and-how-to-find-them/

Wer mehr zu den Münchhausen-Zahlen wissen will, findet es genauer hier beschrieben: https://de.wikipedia.org/wiki/M%C3%BCnchhausen-Zahl

Kurz gesagt: 3^3 + 4^4 + 3^3 + 5^5 = 3435

In F# schreibt man das so, Zweck der Übung ist ja, das ich mich gerade ein wenig in F# reinschnuppere:

let specialpown (i:int64) =
    match i with
    | 0L -> 0L
    | _ -> pown i (int i)
    
let digits (number:int64) = 
    (string) number |> Seq.map(fun i -> ( (int64) ((int i) % 48) ) )

let isMunchhausen number =
    digits number |> Seq.map (fun i -> specialpown i) |> Seq.sum = number 

digits 1234L |> Seq.toList
isMunchhausen 3435L

seq { 1L..500000000L } |> Seq.filter isMunchhausen |> Seq.toList

F# interactive zeigt dann folgendes in der Konsole:

val specialpown : i:int64 -> int64
val digits : number:int64 -> seq<int64>
val isMunchhausen : number:int64 -> bool
val it : int64 list = [1L; 3435L; 438579088L]

Ja, und die einzigen (bisher) bekannten Münchhausenzahlen sind diese 3:

  • 1
  • 3.435
  • 438.579.088

 

Send a „Cancel current Operation“ to IBM Notes with Powershell

On new Notebooks or Tablets, one key is missing:

– the pause-key

To cancel the current Operation within Notes, you can send a key-combination to the Notes-Process.

I realized this with the following Powershell-Script:

add-type -AssemblyName microsoft.VisualBasic
add-type -AssemblyName System.Windows.Forms

$id = (Get-Process "notes2").Id
[Microsoft.VisualBasic.Interaction]::AppActivate($id)
[System.Windows.Forms.SendKeys]::SendWait(“{BREAK}”)

DNS resolving Issues with ASUS RT-AC87U

I recently bought an new Router – the ASUS RT-AC87U.

I used it for some weeks with no problems, unless I tried to insert my 3G Data-Stick into the USB-Port (for failover reasons).

Since then, I did have occasional problems in resolving various internet adresses.


PS C:\Users\Harald> nslookup orf.at
Server: router.asus.com
Address: 192.168.1.1

*** orf.at wurde von router.asus.com nicht gefunden: Query refused.

Query refused? At first, I blamed my provider, and tried to configure the dns-adresses in the router to the Google-DNS-Servers (8.8.8.8 and 8.8.4.4) – unfortunately this did not help. The same error messages appeared and appeard. Refreshing the Site in the browser did help in most cases.

The Asus-Routers uses the dnsmasq DNS-Deamon to act as a DNS-Server. However, the DNS-Servers the deamon uses itsself are in the /etc/resolv.conf file. And there lies the magic (or the root of my problem).

If the router gets the (2) DNS-Servers Adresses from the Provider, it stores these IPs in the resolv.conf file. If you configure DUAL-WAN, you will get 4 DNS-Adresses into the file (2 for each provider). Providers usually only allow DNS-Queries from there own network…

So in some cases, the router uses WAN-Connection from Provider A, but tries to resolve the addresses with the DNS-Server from Provider B – which then gets refused.

What did I do?

I set the DNS-Server Adresses manually in /etc/resolv.conf via vi to only two entries (8.8.8.8, 8.8.4.4) and until now it works like a charm.

Exporting Java-keystore certificates into a Textfile (.pem)

Sometimes products get simply better, so does Tomcat. Beginning with Version 7 it is possible to specify the certificates for the listener in Apache httpd (OpenSSL-Style). For me, this is much easier to understand and easier to configure.

To export all your trusted CA’s to a textfile in .pem format, you can use the much loved/hated java keytool:

The keytool lives in %JAVA_HOME%/bin/ and has to be called with this parameters:

  • -list (lists all certificates in the store)
  • -rfc (lists the certificates in rfc style
  • -keystore (path to the java-keystore you want to export
  • -storepass (password to the java-keystore you want to export

This parameterset gives you an nice formatted text-output of your certificates.

The final step is, to forward the text-output into a file, and voila – finished you have a file, which you can use in your Tomcat-Connector for the parameter „SSLCACertificateFile“.

& 'C:\Program Files\Java\jdk1.8.0_60\bin\keytool.exe' -list -rfc -keystore C:\certs\cacerts -storepass changeit > all-cas.pem