Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • Urban 22:51 on 8 Feb. 2023 Permalink |  

    Cisco AnyConnect with TouchID on MacOS 

    Quite annoying that AnyConnect doesn’t support TouchID on MacOS, so you need to type in your password every time. But there’s a fix:

    • AnyConnect also has a command-line version, the util is located in /opt/cisco/anyconnect/bin/vpn
    • It is interactive, so upon invoking you must enter your username and password
    • This can be done by piping the username and password to the vpn utility
    • To prevent having your password in plaintext, you can use the command-line password manager pass that saves secrets in encrypted GPG files: https://www.passwordstore.org/
    • However this means you now need to enter the GPG secret on every connect
    • To solve this, install and configure the pinentry-touchid utility that replaces the built-in CLI dialog and saves the secret in the Keychain https://jorgelbg.me/2021/08/introducing-pinentry-touchid/
    • Voila, now you can connect using TouchID

    The following helper script from Superuser1 is useful to easily control the vpn status:

    #!/bin/bash
    
    # Easily connect to Cisco AnyConnect VPN
    
    # Get first parameter
    COMMAND="$1"
    
    case $COMMAND in
        connect | CONNECT | c | C)
            printf "2\n${username}\n$(pass show my_password_entry)\n" | \
                /opt/cisco/anyconnect/bin/vpn -s connect remote_host_url
            ;;
    
        disconnect | DISCONNECT | d | D)
            /opt/cisco/anyconnect/bin/vpn disconnect
            ;;
    
        *)
            cat <<EOF
    Usage: vpnctl COMMAND
           connect | CONNECT | c | C    Connect to the VPN
           disconnect | DISCONNECT | d | D    Disconnect from the VPN
    EOF
            ;;
    esac

    1. https://superuser.com/a/1723439 []
     
  • Urban 21:48 on 28 Apr. 2020 Permalink |  

    Cassandra auto-expiring data 

    Just found a beautiful feature of Cassandra — a single update that:

    • performs an upsert (insert or update), so there’s no need to check for existing data
    • ensures items are unique — because we’re using a set { … }
    • and takes care of individual item expiration: each item is valid only 2 weeks, after that it is removed, and when there are no more items left,  the row is removed as well
    UPDATE covid_contact_tracing USING TTL 1209600 
    SET people_met = people_met + {'alice','charlie'}
    WHERE user = 'bob';

    Seems to behave exactly as expected:

    • If Bob meets Alice multiple times, each time Alice’s the TTL is reset to 2 weeks
    • After 2 weeks Alice indeed expires and is removed from the set
    • When all contacts expire, Bob is also removed

    There are drawbacks, however:

    • There’s no way to query a TTL of a collection (set/list/map) item — so you can never know how long it has to live. Or if it has a TTL set at all.
    • If you have existing items without TTL, they have to be reinserted with TTL; this means tons of writes, but at least the whole set can be reinserted at once.
    • This breaks idempotence of writes: you cannot have a job to replay writes (for example, from multiple sources to decrease probability of missing items), since this would reset the TTL
     
  • Urban 22:33 on 29 May. 2017 Permalink |  

    A tour of Menger sponge 

    Done as a WebGL shader. Runs much smoother than a comparable implementation in three.js

    Direct link to Shadertoy, in case the embed doesn’t work.

     

     

     
  • Urban 20:14 on 11 Jan. 2017 Permalink |  

    A glimpse of Sri Lanka 

    To my great surprise (and delight), one of my shots from Sri Lanka was published in the December 2016 issue of the National Geographic Slovenija magazine 🙂

    20161102-_MG_4980

    20170114-_MG_6489

    Below are some of my other favorite shots.

    20161029-IMG_3587b 20161029-IMG_3615b 20161029-IMG_3686 20161029-IMG_3833b 20161031-_MG_4160b  20161105-_MG_6066

    This was a serious photo tour (and an awesome group of enthusiasts), which means we were snapping like crazy. But I still have a long way to go 🙂 More photos.

     
  • Urban 15:41 on 11 Jul. 2015 Permalink |  

    Torpedo marmorata 

    During vacation snorkeling I stumbled upon an electric ray. I was perplexed by its odd looks, and the fact that it seemed eerily undisturbed by my pursuit. Which is why I left it alone.

    Here’s a pic, and a short clip, taken with a modded GoPro Hero21.

    Marbled electric ray

    I had some trouble looking it up afterwards, but this nice guide helped me — it seems to be a marbled electric ray2. If I knew they were that common in Croatia, I wouldn’t have gone so close; supposedly they can produce a 200V discharge3, and on youtube you can find clips of fishermen getting shocked 🙂

     

    1. fitted with a mock underwater flat lens, made from a wide (Cedevita) bottle cap and a cheap kids’ diving mask; the aged Hero2, which I bought for the sole purpose of underwater photography, was completely unfit for it, despite having the housing rated for 200m–the original curved lens produced blurry images.

      Here’s a pic of the mod:

      hero2-mod

      []

    2. also, Torpedo marmorata. It must be really common, since it has 8 names in Croatian: drhtulja šarulja, mramorna drhtulja, trn, trnjevača, tresnavka, banjača, pjegava drhtulja, renjok; see here https://hr.wikipedia.org/wiki/Drhtulja_%C5%A1arulja []
    3. see here https://en.wikipedia.org/wiki/Marbled_electric_ray  []
     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel