Skip to content

Instantly share code, notes, and snippets.

View tulir's full-sized avatar
🐈

Tulir Asokan tulir

🐈
View GitHub Profile
@tulir
tulir / .checkroom.sh
Last active April 9, 2020 08:45
Matrix room server version checker
#!/bin/bash
if [[ -z "$HOMESERVER" ]]; then
echo "Please set the HOMESERVER environment variable to the C-S API URL (e.g. https://matrix.org)"
exit 1
elif [[ -z "$ACCESS_TOKEN" ]]; then
echo "Please set the ACCESS_TOKEN environment variable to your access token"
exit 1
elif [[ -z "$1" ]]; then
echo "Usage: $0 <alias without #>"
exit 1
@tulir
tulir / .update-riot.sh
Last active May 12, 2020 10:08
Riot updater
#!/bin/bash
cd /var/www
old_version="v$(cat riot/version)"
version="latest"
if [[ ! -z "$1" ]]; then
version="tags/$1"
fi
@tulir
tulir / kick.sh
Created January 8, 2019 21:17
Matrix kick script
#!/bin/bash
if [ -z "$MATRIX_HOMESERVER" ]; then
read -p "Enter homeserver URL: " MATRIX_HOMESERVER
fi
base_url="$MATRIX_HOMESERVER/_matrix/client/r0"
if [ -z "$MATRIX_ACCESS_TOKEN" ]; then
read -p "Enter access token: " MATRIX_ACCESS_TOKEN
fi
auth="Authorization: Bearer $MATRIX_ACCESS_TOKEN"
resp=$(curl -s -H "$auth" "$base_url/account/whoami")
@tulir
tulir / identity.md
Last active July 28, 2022 10:29
Identity
@tulir
tulir / defaults.yml
Last active March 5, 2017 23:05
Ansible role for libpam_u2f
u2f_keys:
- Output of `pamu2fcfg` without the username prefix
- Supports multiple entries (add a colon after each entry except the last)
u2f_rules_path: https://raw.githubusercontent.com/Yubico/libu2f-host/master/70-u2f.rules
u2f_rules_checksum: sha256:c9998bb23f4c87d1469e5754f321138ad164e67d734dcb6a3ff2520f8f683448
@tulir
tulir / dconf.py
Created February 4, 2017 16:36
Ansible utilities for GNOME Shell configuration
#!/usr/bin/python
from ansible.module_utils.basic import *
def _set_value(module, path, value):
val = module.run_command(["dconf", "write", path, value])[1].strip()
def _get_value(module, path):
@tulir
tulir / apm.py
Created January 9, 2017 20:48
Ansible modules
#!/usr/bin/python
import subprocess
from ansible.module_utils.basic import *
def get_installed(links=False):
packages = {}
output = subprocess.check_output([
@tulir
tulir / gitcheck.sh
Last active October 22, 2018 16:51
Git checker
#!/bin/bash
# Git checker - A script to recursively find and check the status of Git repositories
# Copyright (C) 2016-2018 Tulir Asokan
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,