Skip to content

Instantly share code, notes, and snippets.

View ralexx's full-sized avatar

Rob Alexander ralexx

View GitHub Profile
def recursive_defaultdict():
"""x = recursive_defaultdict()
x['key0']['key1'] = 'value' # etc."""
return defaultdict(recursive_defaultdict)
@ralexx
ralexx / mutt_mods.md
Created August 26, 2020 21:03
Allow mutt to write to mailbox

Upgrades break custom settings

Homebrew upgrades will overwrite the settings file linked to /usr/local/etc/Muttrc (e.g. /usr/local/Cellar/mutt/1.14.6/etc/Muttrc). Copying over it will restore customized settings. cp ~/repos/dotfiles/Muttrc /usr/local/etc/Muttrc

Set correct permissions

https://lists.debian.org/debian-user/2002/01/msg00172.html

  • The user does not matter but the group must be 'mail'.
  • Permissions do matter.
chown root:mail /usr/local/bin/mutt_dotlock
@ralexx
ralexx / connection_status.sql
Created December 9, 2019 17:08
Status information on active/idle Postgresql connections
SELECT
datid,
datname,
pid,
backend_type,
application_name,
--xact_start,
query_start,
state_change,
--wait_event_type,
@ralexx
ralexx / available_conn.sql
Created December 9, 2019 16:37
Postgresql available connections
-- https://dba.stackexchange.com/a/161761
SELECT
max_conn,
used,
res_for_super,
max_conn-used-res_for_super res_for_normal
FROM
(
SELECT
COUNT(*) used
@ralexx
ralexx / audi_mmi.md
Last active January 21, 2020 21:22
Audi MMI map update

Prep

  • >=32GB SD card formatted to FAT32 (MS-DOS)
  • my.audiusa user name and password
  • Java 8 (because 11 doesn't work)

Steps

  1. https://www.audiusa.com/myaudi
  2. Click on "Audi connect® services and Key User registration" icon, underneath image of car
  3. Click on "Services" tab if not selected
  4. Click on "Map update"
@ralexx
ralexx / conda_fish.md
Last active February 26, 2018 06:55
Fixing conda's fish wrapper (as of conda v4.4.10)

Problem

After updating conda to version 4.4.x, the fish shell wrapper intended to define a conda function that knows the path of the conda executable and calls it regardless of whether the Anaconda/Miniconda installation is in $PATH. For me, this fails with

⋊> ~ conda activate base
fish: Unknown command 'shell.fish'
- (line 1):
begin; shell.fish activate base
 ^
@ralexx
ralexx / pullhair.md
Last active October 2, 2017 22:12
Installing Linux on MacBook 2,1 with unresponsive CD-ROM
  1. Download and install rEFInd

Follow @astrofloyd's instructions, including:

  1. Obtain a copy of ISO 2 USB EFI Booter for Mac
  2. diskutil list to find the node name of your USB drive
  3. Format the USB drive with a single FAT32 partition (use diskutil eraseDisk fat32 UNTITLED /dev/diskX)
  4. cd into the drive and mkdir -p efi/boot (from the computer's root drive the path should look something like /dev/diskX/efi/boot)
  5. Copy bootIA32.efi onto the USB drive and rename it: cp /location/of/bootIA32.efi ./boot.efi
  6. Copy the Linux distribution .iso file and rename it to boot.efi
@ralexx
ralexx / collapsible_md.txt
Last active September 15, 2017 16:21
Collapsible comments
<!-- https://github.com/dear-github/dear-github/issues/166#issuecomment-322367328 -->
<details>
<summary>Click to see</summary>
```python
True is not False
```
</details>
@ralexx
ralexx / sqlite3.md
Created March 22, 2017 18:42
custom compile of Sqlite3 for Python 3.6

For building and installation with conda.

Make a working directory

cd /tmp
mkdir foo
cd foo

Download Conda recipe from Github

wget the links if you so desire