Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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"
# 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 / 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 / .imgurrc
Last active August 29, 2015 14:14
Imgur uploader
[auth]
client_id=
client_secret=
access_token=
refresh_token=
[general]
notify=False
clipboard=True
browser=True
@timss
timss / cpulow-high startup
Last active August 29, 2015 14:10
Vim startup time
~ > cpulow
~ > for i in {1..5}; do time vim -c q .vimrc; done
real 0m0.526s
user 0m0.472s
sys 0m0.020s
real 0m0.479s
user 0m0.412s
sys 0m0.040s
@timss
timss / System Information
Last active August 29, 2015 14:06
DOTA2 crashed when I witness any using the item of Ethereal Blade - https://github.com/ValveSoftware/Dota-2/issues/1529
Processor Information:
Vendor: GenuineIntel
CPU Family: 0x6
CPU Model: 0x1e
CPU Stepping: 0x5
CPU Type: 0x0
Speed: 2794 Mhz
4 logical processors
4 physical processors
HyperThreading: Unsupported
@timss
timss / Steam - System information
Last active August 29, 2015 14:06
Steam client fails to redraw(?) after suspending - https://github.com/ValveSoftware/steam-for-linux/issues/3507
Processor Information:
Vendor: GenuineIntel
CPU Family: 0x6
CPU Model: 0x1e
CPU Stepping: 0x5
CPU Type: 0x0
Speed: 2794 Mhz
4 logical processors
4 physical processors
HyperThreading: Unsupported
@timss
timss / DEBUGGER=gdb steam
Last active August 29, 2015 14:06
Segmentation fault when using microphone in Steam settings or Dota 2 - https://github.com/ValveSoftware/steam-for-linux/issues/3503
$ DEBUGGER=gdb steam
Running Steam on debian 64-bit
STEAM_RUNTIME is enabled automatically
GNU gdb (Debian 7.7.1+dfsg-3) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".