How do I actually write acpid event scripts that detect when headphones are plugged in?

I’m using acpid to detect when my headphones are plugged in. According to acpid_listen, the relevant events are jack/headphone HEADPHONE unplug jack/headphone HEADPHONE plug I created the file /etc/acpi/events/headphone_jack like this: event=jack/headphone.* action=/etc/acpi/actions/headphone.sh “%e” The event still doesn’t trigger if I use jack[ /]headphone instead. The script /etc/acpi/actions/headphone.sh looks like this: amixer set Master off…

Details

calculate sunrise and sunset times from a datetime index using ephem in Python

I have a daily time series with DateTime index. Now, I want to calculate the sunrise and sunset times for each day in the dataframe. The result will be presented in columns rise and set. Below is my script using ephem. import ephem import datetime AliceS=ephem.Observer() AliceS.lat=’-23.762′ AliceS.lon=’133.875′ AliceS.date = df.index sun = ephem.Sun() df[‘rise’]…

Details

Fragment inside a ViewPager does not have the activity associated with it

I have a use case in which I use a ViewPager with TabLayout. I have used the Android tutorial linked here. My Layout <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical”> <androidx.viewpager.widget.ViewPager android:layout_width=”match_parent” android:layout_height=”match_parent” android:id=”@+id/notification_view_pager”> <com.google.android.material.tabs.TabLayout android:id=”@+id/notification_tabs” android:layout_width=”match_parent” android:layout_height=”wrap_content” /> </androidx.viewpager.widget.ViewPager> </LinearLayout> My activity public class MyActivity extends AppCompatActivity { int currentFocussedTab = -1; private…

Details

QML: Dynamic view re-ordering in original model

Implemented QML Dynamic View Ordering by Dragging View Items using this Qt tutorial: QML Dynamic View Ordering Tutorial. Original underlying model is QAbstractListModel descendant in our case. Model stores data in a QList<QObject*> objectList; field type. Works fine, however item ordering changed in proxy DelegateModel only. How to change items order automatically in original underlying…

Details

Adding cipher suites to nginx config the right way

I need to add ssl_ciphers in my nginx config. According to https://wiki.mozilla.org/Security/Server_Side_TLS the following are recommended cipher suites (with intermediate compatibility): Cipher suites (TLS 1.3): TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256 Cipher suites (TLS 1.2): ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 My question is quite simply: how do I add both TLS 1.3 and TLS 1.2 suites in my nginx config? Like this? ssl_protocols TLSv1…

Details