Skip to content

Instantly share code, notes, and snippets.

@dubcl
dubcl / text_demo.py
Created April 24, 2018 03:29
text demo for ssd1306
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014-17 Richard Hull and contributors
# See LICENSE.rst for details.
# PYTHON_ARGCOMPLETE_OK
"""
Use misc draw commands to create a simple image.
Ported from:
@dubcl
dubcl / awesomewm_spotify_notification_fix
Last active April 23, 2018 01:00 — forked from alepmaros/awesomewm_spotify_notification_fix
Change the size of the Spotify notification on awesomewm 4.x
-- Changing spotify notifications.
naughty.config.presets.spotify = {
-- if you want to disable Spotify notifications completely, return false
callback = function(args)
return true
end,
-- Adjust the size of the notification
height = 100,
width = 400,
@dubcl
dubcl / mysql_table_size.sql
Last active April 16, 2018 19:46
MySQL Table Size
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;
SELECT table_schema as `Database`, table_name AS `Table`, round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` FROM information_schema.TABLES ORDER BY (data_length + index_length) DESC;
@dubcl
dubcl / netdata.conf
Created April 12, 2018 18:38
Netdata config for /opt install
# Get config from http://127.0.0.1:19999/netdata.conf
[backend]
data source = average
buffer on failures = 10
enabled = yes
update every = 10
prefix = netdata
destination = IP-DEST:4242
timeout ms = 20000
@dubcl
dubcl / haproxy1.8-stretch.md
Last active April 12, 2018 14:58
Install haproxy 1.8 on Debian Stretch

Install haproxy 1.8 on Debian Stretch

https://haproxy.debian.net

echo "deb http://httpredir.debian.org/debian stretch-backports main" | tee /etc/apt/sources.list.d/backports.list
echo deb http://haproxy.debian.net stretch-backports-1.8 main | tee /etc/apt/sources.list.d/haproxy.list
curl https://haproxy.debian.net/bernat.debian.org.gpg | apt-key add -
apt-get update
apt-get install haproxy=1.8.\* -t stretch-backports
@dubcl
dubcl / ntpdate-workaround.md
Created April 10, 2018 21:25
ntpdate workaround

The problem

$  ntpdate pool.ntp.org
10 Apr 19:32:00 ntpdate[3519]: no server suitable for synchronization found

The Fix

@dubcl
dubcl / kvm_unhandled_rdmsr.sh
Created March 28, 2018 22:12
kvm unhandled rdmsr
echo 1 > /sys/module/kvm/parameters/ignore_msrs
@dubcl
dubcl / netdata-install.sh
Last active June 12, 2018 16:15
netdata install debian
apt-get install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl
cd /opt
git clone https://github.com/firehol/netdata.git --depth=1
cd netdata
./netdata-installer.sh
ln -s /opt/netdata/netdata-updater.sh /etc/cron.daily/netdata-updater
chown -Rf netdata:netdata /opt/netdata/web
service netdata restart
@dubcl
dubcl / kill_process_older_than.sh
Last active March 19, 2018 14:12
Kill process older than
#!/bin/bash
APPNAME=$1
USER=$(whoami)
for PID in $(pgrep -u $USER $APPNAME); do TIME=$(ps --noheaders -o etimes $PID); if [ $TIME -gt 60 ];then kill -9 $PID;fi ;done
@dubcl
dubcl / debian7on.md
Created March 9, 2018 16:13
Create Debian 7 OpenNebula Image

Then, the complete steps are:

  • Create qcow2 image
qemu-img create -f qcow2 foo.qcow2 2G
  • Boot whit the new disc install basic OS, in my case, I download debian 7.11 iso