Skip to content

Instantly share code, notes, and snippets.

@timss
timss / strava_gear.js
Created October 3, 2023 15:37
Bulk edit gear on Strava activties
// https://old.reddit.com/r/Strava/comments/hw7zh0/how_to_bulk_edit_shoes_on_your_activities/
// Follow instructions above to get shoe ID
var shoe_id = 123456789
// Open inline/quick edit for each activity
document.querySelectorAll('.quick-edit').forEach(b => b.click())
// Unhide shoe selection if hidden due to it being "run-only"
var shoes = document.querySelectorAll('.shoe-id')
for (var i = 0; i < shoes.length; i++) {
@timss
timss / ufw.sh
Last active September 21, 2023 09:29
Basic UFW setup
# /etc/default/ufw
# ufw default deny outgoing
# ufw default deny incoming
DEFAULT_INPUT_POLICY="DROP"
DEFAULT_OUTPUT_POLICY="DROP"
# Consider /etc/ufw/before.rules etc
$ ufw allow out 22/tcp
$ ufw allow out 53/udp
$ ufw allow out 80/tcp
@timss
timss / discord_emojis.js
Created August 21, 2023 12:13
"Acquire" Discord emojis
// console.log(p[0].children)
//var p = document.querySelectorAll("[class*=emojiItem]");
// or console.log() stuff
// var a = window.open("");
// emojiImage-123abc is used for server settings emoji
// emojiItem-123abc is used for the emoji picker, but can be tricky to filter out
// default emojis or just the emoji of the server you're in
var p = document.querySelectorAll("[class*=emojiImage]");
@timss
timss / bluetooth_resume.yml
Created May 18, 2018 13:44
Simple Ansible playbook for configuring systemd to restart the bluetooth service on resume
- hosts: all
connection: local
vars:
ask_become_pass: yes
tasks:
- name: Configure systemd to restart bluetooth service on resume
copy:
dest: /lib/systemd/system-sleep/bluetooth-resume
mode: 0755
content: |
@timss
timss / startuptime.md
Last active June 29, 2017 21:04
timss/vimconf startup time

Normal desktop:

$ grep -m 1 "model name" /proc/cpuinfo 
model name	: Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz

$ time vim -c q .vimrc
real    0m0.159s
user    0m0.120s
sys     0m0.004s
@timss
timss / log.py
Created April 11, 2017 07:56
Python logging across multiple modules with custom handler/filter and splitting loglevels between stdout/stderr
#!/usr/bin/env python3
import logging
import sys
import sublog
logger = logging.getLogger()
# http://stackoverflow.com/a/24956305/1076493
@timss
timss / include.yml
Last active February 28, 2017 16:05
Ansible 'become' clause for include statements
# ./roles/foo/tasks/main.yml
- include: foo.yml
- include: foo.yml
become: yes
# ./roles/foo/tasks/foo.yml
- lineinfile:
dest: "~/.bashrc" # resolves '~' on runtime as any other command', unlike ansible_env.HOME
regexp: "^HISTSIZE=.*"
line: "HISTSIZE=10000"
@timss
timss / service.yml
Created August 17, 2016 08:07
Disable autostart of services after first installation on Debian/Ubuntu
---
- name: Check if service is installed
stat:
path: /etc/init.d/{{ item }}
register: services
with_items:
- apache2
- mysql
- name: Disable autostart of services after installation
@timss
timss / packages.txt
Last active January 10, 2020 20:58
QEMU/KVM, OVMF, UEFI – invalid block device contents
- qemu/kvm 2.6
- edk2.git/ovmf x64 20160728
- libvirt-daemon 2.0.0