Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am pretorh on github.
  • I am pretorh (https://keybase.io/pretorh) on keybase.
  • I have a public key whose fingerprint is F7D8 8A0A 1F78 A572 8E6D BBA7 A676 D9AF 5767 085D

To claim this, I am signing this object:

@pretorh
pretorh / Listing watched files on kodi (xbmc).md
Last active May 23, 2022 16:58
Listing watched files on kodi (xbmc)

Listing watched files on kodi (xbmc)

To list the full path of all watched files that are still accessable: (assuming the sql query was saved to list-watched-files.sql)

sqlite3 ~/.kodi/userdata/Database/MyVideos90.db < list-watched-files.sql | xargs -L 1 -I filename ls "filename" 2>/dev/null

Explanation

Get the list of watched files from the Kodi database

Kodi uses sqlite databases, located in ~/.kodi/userdata/Database/. The video database is MyVideosXX.db, where XX is the version (MyVideos90.db on OSMC on 2015-05-09)

@pretorh
pretorh / Teamcity Postgres migration (mac).md
Last active November 8, 2023 12:57
Summary of steps required to migrate Teamcity database to a Postgres db on mac

Teamcity references (follow these/updated versions, use below as summary)

The steps are based on zsh history, so there might me some missing.

Directory locations

TeamCity Data Directory

/private/var/root/.BuildServer

@pretorh
pretorh / basic.md
Created January 25, 2016 15:46
Setup live arch vm

General setup of live arch VM

Setup on VM

  • Boot the vm, select x86 / x86_64 and enter
  • start ssh daemon:
    • systemctl start sshd
  • change the root password
    • passwd

Setup ssh

echo LANG=en_US.UTF-8 >> /etc/environment
echo LC_ALL=en_US.UTF-8 >> /etc/environment
hostnamectl set-hostname --static example.com
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
openssl req -new -key server.key -out server.csr -subj "/CN=localhost"
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
rm server.pass.key server.csr

(use "/C=/ST=/L=/O=IT/CN=localhost" with country code, state|province name, location name for more details in the cert)

Keybase proof

I hereby claim:

  • I am pretorh on github.
  • I am pretorh (https://keybase.io/pretorh) on keybase.
  • I have a public key whose fingerprint is DA8A 02D8 D0B7 97EB 91DE 6C23 1CD8 941B F35B 7444

To claim this, I am signing this object:

@pretorh
pretorh / setup and use test gpg keys.md
Created September 30, 2018 08:31
GPG test environment

creating:

GNUPGHOME=${GNUPGHOME?'need path for new gnupg home dir'}
GPG_PASS_PHRASE=${GPG_PASS_PHRASE-passphrase}

# refuse to overwrite existing
if [ -e "$GNUPGHOME" ] ; then
    echo "$GNUPGHOME already exists!"
 exit 1
@pretorh
pretorh / mergeLiveData.kt
Last active August 10, 2019 21:04
merge two live data sources into a single mediator live data, returning data when either of them changed (not chained)
import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData
fun <T1, T2> mergeLiveData(source1: LiveData<T1>, source2: LiveData<T2>): LiveData<Pair<T1, T2>> {
val result = MediatorLiveData<Pair<T1, T2>>()
var data1: T1? = null
var data2: T2? = null
fun postDataIfBothAvailable() {