Skip to content

Instantly share code, notes, and snippets.

timss

  • Norway
Block or report user

Report or block timss

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@timss
timss / bluetooth_resume.yml
Created May 18, 2018
Simple Ansible playbook for configuring systemd to restart the bluetooth service on resume
View bluetooth_resume.yml
- 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 Jun 29, 2017
timss/vimconf startup time
View startuptime.md

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 Apr 11, 2017
Python logging across multiple modules with custom handler/filter and splitting loglevels between stdout/stderr
View log.py
#!/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 Feb 28, 2017
Ansible 'become' clause for include statements
View include.yml
# ./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 Aug 17, 2016
Disable autostart of services after first installation on Debian/Ubuntu
View service.yml
---
- 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 May 18, 2018
QEMU/KVM, OVMF, UEFI – invalid block device contents
View packages.txt
- qemu/kvm 2.6
- edk2.git/ovmf x64 20160728
- libvirt-daemon 2.0.0
@timss
timss / btrfs.txt
Last active Aug 20, 2017
ion notes (i3 / kde / iommu)
View btrfs.txt
# /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
View fb_iptables.sh
# Block facebook.com mon-fri, 08:00 - 17:00, from desktop net
# Fetches all subnets registered to Facebook and it's domain aliases
for i in $(whois -h whois.radb.net -- '-i origin AS32934' |
awk '/^route:/ { if(!uniq[$2]++) print $2 }'); do
$ipt -A FORWARD -s $desktop_net -d $i \
-m time --timestart 08:00 --timestop 17:00 --weekdays Mon,Tue,Wed,Thu,Fri \
-j DROP
done
@timss
timss / .imgurrc
Last active Aug 29, 2015
Imgur uploader
View .imgurrc
[auth]
client_id=
client_secret=
access_token=
refresh_token=
[general]
notify=False
clipboard=True
browser=True
You can’t perform that action at this time.