Skip to content

Instantly share code, notes, and snippets.

View timrichardson's full-sized avatar

Tim Richardson timrichardson

  • GrowthPath
  • Melbourne, Australia
View GitHub Profile
@timrichardson
timrichardson / celery_heartbeat_kubernetes.md
Last active March 4, 2024 07:48
kubernetes health check for celery

from celery/celery#4079 (comment)

from celery import Celery, bootsteps
from celery.signals import after_setup_logger, setup_logging, worker_ready, worker_shutdown

HEARTBEAT_FILE = Path("/tmp/worker_heartbeat")
READINESS_FILE = Path("/tmp/worker_ready")
@timrichardson
timrichardson / amazon_music_linux.md
Last active February 18, 2024 12:44
Amazon Music Linux External DAC high bit rates

Amazon Music streams different tracks at different rates, many above the default bit rate that pipewire ships with. This is how to fix it.

Firstly, I am running the Windows Amazon Music app via Crossover, a user-friendly version of wine. It works, it's stable. Ubuntu 22.04. Getting the app can annoying. Once you have the download file, keep it. The app automatically updates and amazingly this works in Linux too. here are some tips: https://uk.amazonforum.com/s/question/0D56Q0000CMRC0dSQH/amazon-music-desktop-app-deletedmissing

Reduce CPU use: I get much, much lower CPU by turning on the DXVK Advanced Option in the Crossover Bottle setting, which keeps the PC fans almost silent for me. The app has an option to use Hardware Accelarated Rendering. I doubt this works on Linux, and it makes no difference. The app doesn't do much rendering while playing back, perhaps this is more for browsing.

@timrichardson
timrichardson / gist:f3be87134d2a06737b6b6678394be01e
Created April 12, 2021 05:56
Turn off bitmap fonts for Calibri in Linux
# put this in ~/.config/fontconfig (~ means in your home directory)
# this is relvevant if if you copied Calibri from a Windows fonts directory into your Linux install
# this way you get the latest version of Windows fonts, but the bitmapping for Calibri is not really designed to be used
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
<test qual="all" name="family" compare="contains">
@timrichardson
timrichardson / gist:874c0d7ca2b15d2a034d96ccda219df1
Last active December 4, 2020 12:05
ansible playbook to set docker postgres configuration parameters based on host memory using community.general.postgresql_set and ansible_memtotal_mb
# ansible-playbook -i inventory -v yourplaybook.yml
# you need to add community.general to the local machine's ansible setup
# https://docs.ansible.com/ansible/latest/collections/community/general/
# ansible needs to be 2.9.10 or later
---
- name: Snippets regarding postgres key parameter configuration
hosts: all
@timrichardson
timrichardson / gist:1fd8ad33215377d849cb54266148beb1
Created June 2, 2020 04:29
Compile kernel from git, ubuntu
https://wiki.ubuntu.com/KernelTeam/GitKernelBuild
to return to the repo files,
git clean -fdx
--- TLP 1.2.2 --------------------------------------------
+++ Configured Settings: /etc/default/tlp
TLP_ENABLE=1
TLP_DEFAULT_MODE=AC
TLP_PERSISTENT_DEFAULT=0
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60
@timrichardson
timrichardson / gmail_signature_editing.py
Last active September 20, 2024 05:46
Modern way to edit gmail signatures with python3 and the gmail API
from string import Template
import time
import pytest
from google.oauth2 import service_account
from googleapiclient.discovery import build
from googleapiclient.errors import *
from google.auth.exceptions import *
import easygui
import pandas as pd
@timrichardson
timrichardson / 0_reuse_code.js
Created July 22, 2016 23:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@timrichardson
timrichardson / gmail_signatures.py
Last active September 8, 2021 18:06
Use Python, OAuth2 and Google APIs to mass-update gmail signatures of a Google Apps for Work domain. Using a google service account for the credential.
# python 2.7
# *********************************************************************************************************
#
#
#
# Please see https://gist.github.com/timrichardson/e6ee6640a8b7fe664f3a5a80406ca980
#
# for a modern way of doing this, using the current API and python 3
#
@timrichardson
timrichardson / unleashed_api.py
Created April 30, 2015 11:24
Some examples of Unleashed API in Python 3.4
__author__ = 'tim'
import requests.auth
import binascii
import hashlib
import hmac
import prefs
import json
# tested only with python 3.4