Skip to content

Instantly share code, notes, and snippets.

Avatar
🐈

Tulir Asokan tulir

🐈
View GitHub Profile
@tulir
tulir / .checkroom.sh
Last active Apr 9, 2020
Matrix room server version checker
View .checkroom.sh
#!/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
View .update-riot.sh
#!/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 Jan 8, 2019
Matrix kick script
View kick.sh
#!/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")
View identity.md
@tulir
tulir / defaults.yml
Last active Mar 5, 2017
Ansible role for libpam_u2f
View defaults.yml
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 Feb 4, 2017
Ansible utilities for GNOME Shell configuration
View dconf.py
#!/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 Jan 9, 2017
Ansible modules
View apm.py
#!/usr/bin/python
import subprocess
from ansible.module_utils.basic import *
def get_installed(links=False):
packages = {}
output = subprocess.check_output([
@tulir
tulir / keybase.md
Created Oct 27, 2016
Keybase Proof
View keybase.md

Keybase proof

I hereby claim:

  • I am tulir on github.
  • I am tulir (https://keybase.io/tulir) on keybase.
  • I have a public key ASDjnZjkiozLpYqSXxkPevtKCrQ6KueRTBFCqq-Xg9LXGgo

To claim this, I am signing this object:

@tulir
tulir / gitcheck.sh
Last active Oct 22, 2018
Git checker
View gitcheck.sh
#!/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,
You can’t perform that action at this time.