Skip to content

Instantly share code, notes, and snippets.

View munhitsu's full-sized avatar

Mateusz Łapsa-Malawski munhitsu

  • cr3.io
  • London, UK
View GitHub Profile
@munhitsu
munhitsu / .envrc
Created October 19, 2015 10:45
pyvenv/venv + direnv
if ! [ -d venv ]; then
pyvenv venv
fi
source venv/bin/activate
@munhitsu
munhitsu / gist:17b24825a1f383d6b6b9
Created October 5, 2015 09:59
high kworker CPU usage / high system CPU usage
kworker is accounts for all kernel threads so you will also see high system CPU usage
In my case I've had nearly filled up BTRFS partition, so kernel was constantly searching for space.
tracing kernel - raw
```
# echo l > /proc/sysrq-trigger
# dmesg
```
@munhitsu
munhitsu / db.tf
Created August 27, 2015 11:05
aws_db_instance final_snapshot_identifier
resource "aws_db_instance" "api" {
identifier = "api-${var.stack}"
allocated_storage = 100
engine = "postgres"
engine_version = "9.3.6"
instance_class = "db.m3.medium"
storage_encrypted = true
apply_immediately = false
name = "${var.db_name}"
username = "${var.db_master_username}"
@munhitsu
munhitsu / gist:4617afd21c8e7bd915ad
Created August 13, 2015 13:43
identify unmounted volume filesystem
blkid -o value -s TYPE /dev/xvdh
### Keybase proof
I hereby claim:
* I am munhitsu on github.
* I am munhitsu (https://keybase.io/munhitsu) on keybase.
* I have a public key whose fingerprint is 7859 4A7B 4DEE 7711 75EA 99A4 D4FA D361 158F 52C3
To claim this, I am signing this object:
@munhitsu
munhitsu / gist:e12696b50f0f0a95c749
Created August 5, 2015 15:47
jq for logstash style logs
jq '.["@fields"]' ~/Downloads/app.errors
@munhitsu
munhitsu / script.sh
Last active August 29, 2015 14:26
docker snippets
# remove all containers (only if they are not running)
docker rm $(docker ps -aq)
# remove all containers (even if they are running)
docker rm -f $(docker ps -aq)
# remove all containers and their persistent volumes
docker rm -fv $(docker ps -aq)
# remove all images from docker host
@munhitsu
munhitsu / gist:ba11f4728d726e7cf254
Last active September 13, 2015 15:45
SSL issue on OSX 10.10.3 (docker-compose up / docker-py - failing with: SSL error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590))
# docker-py / docker-compose installed through pip fails with
# SSL error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
# At the moment simplest solution is to use python 2.7.6 natively installed
$ brew uninstall python
# check follwoing commands if everything is ok
@munhitsu
munhitsu / gist:f66fa0b4300669874664
Created March 26, 2015 10:55
salt module function to save dictionary as a json file
import json
import logging
log = logging.getLogger(__name__)
def save_dictionary(filename, # whe to output dictionary
**kwargs # the dictionary itself
):
@munhitsu
munhitsu / gist:ab256f8c6a0640c82a10
Created February 25, 2015 14:05
bloated package but good insight into memory usage
apt-get install smem