Skip to content

Instantly share code, notes, and snippets.

@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 / btrfs.txt
Last active August 20, 2017 10:42
ion notes (i3 / kde / iommu)
# /etc/fstab
defaults,ssd,noatime,compress=lzo
# defrag/recompress post-install
btrfs filesystem defragment -r -v -c lzo / /home
# fstrim (weekly trim)
cp /usr/share/doc/util-linux/examples/fstrim.{service,timer} /etc/systemd/system
systemctl enable fstrim.timer
@timss
timss / get_isp.py
Created May 2, 2013 15:58
Script to get ISP from host (ip/domain) using ip-adress.com.
#!/usr/bin/env python
import html2text
import re
import sys
import urllib2
def get_ip(host):
trac = "http://www.ip-adress.com/ip_tracer/"
pat = "ISP of this IP \[\?\]:\n\n([a-zA-Z ]+)"
@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 / 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
@timss
timss / python-daemon_apscheduler.py
Last active April 4, 2020 04:50
A combination of python-daemon and APScheduler
#!/usr/bin/env python
import apscheduler.scheduler
import daemon.runner
import os.path
import sys
import time
class Core():
def __init__(self):
@timss
timss / python273_install.sh
Last active November 18, 2022 05:33
Python 2.7.3 altinstall script for CentOS 5
#!/bin/bash
#---------------------------------------#
# Python 2.7.3 Install on CentOS 5 #
# https://gist.github.com/timss/5122008 #
# #
# Installs to /usr/local/{bin,lib} #
# Seperate from system default #
# /usr/bin/python(2.4) #
#---------------------------------------#
@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 / 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]");