Skip to content

Instantly share code, notes, and snippets.

@timss
timss / generate_host_cfg.sh
Created May 13, 2014 23:37
Script for generating Icinga host definitions
#!/usr/bin/env bash
# generates a valid [host] configuration file for Icinga
# based off a template, for all the hosts in the subnet
icinga_root="/etc/icinga/objects"
subnet="10.0.0.1.*"
template="template_icinga.cfg"
alias_file="alias.txt"
# navigate to the Icinga configuration directory
@timss
timss / mediainfo.txt
Created September 5, 2014 14:15
mpd http pcm wav stream + mplayer, only giving 705.6 kbit/s
$ mediainfo 06.Black Sun Empire - The Rat (Kemal Remix).flac
General
Complete name : 06.Black Sun Empire - The Rat (Kemal Remix).flac
Format : FLAC
Format/Info : Free Lossless Audio Codec
File size : 43.3 MiB
Duration : 6mn 55s
Overall bit rate mode : Variable
Overall bit rate : 873 Kbps
Album : Driving Insane CD1
@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".
@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 / 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 / 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 / .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 / 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
# 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 / 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"