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 / gist:7656b49417f7d5926652
Created February 12, 2015 11:25
OSX 10.10: pip install lxml
#fatal error: 'libxml/xmlversion.h' file not found
#test 1 (failed)
brew install libxml2
brew install libxslt
brew link libxml2 --force
brew link libxslt --force
#test 2 (passed)
STATIC_DEPS=true pip install lxml
@munhitsu
munhitsu / gist:1a95fb27fef8e6fd1beb
Last active August 29, 2015 14:15
salt hack to automatch/autogenerate role in top.sls (pillar or grain)
base:
{% for role in grains.get('roles') %}
'roles:{{ role }}':
- match: grain
- {{ role }}
{% endfor %}
{% for role in grains.get('roles') %}
'roles:{{ role }}':
- match: grain
@munhitsu
munhitsu / gist:8b80c8a74f01f382088f
Last active August 29, 2015 14:16
linux hdd info/benchmarking
hdparm -I /dev/sda
lshw
ioping -R /dev/sda1
# i.e. get aws ephemeral data
curl http://169.254.169.254/latest/meta-data/block-device-mapping/ephemeral0
@munhitsu
munhitsu / gist:ab256f8c6a0640c82a10
Created February 25, 2015 14:05
bloated package but good insight into memory usage
apt-get install smem
@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 / 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:e12696b50f0f0a95c749
Created August 5, 2015 15:47
jq for logstash style logs
jq '.["@fields"]' ~/Downloads/app.errors
### 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:4617afd21c8e7bd915ad
Created August 13, 2015 13:43
identify unmounted volume filesystem
blkid -o value -s TYPE /dev/xvdh
@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