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
# downlaod from https://apps.apple.com/us/app/macos-ventura/id1638787999?mt=12
sudo /Applications/Install\ macOS\ Ventura.app/Contents/Resources/createinstallmedia --volume /Volumes/USB
@munhitsu
munhitsu / gist:1034876
Last active November 29, 2020 09:10
python 2.7.5 install on OSX (10.8+) using brew (pip, easy_install, virtualenv, virtualenvwrapper)
# In case you had some strange python installation
# NOTE: .pydistutils.cfg seems to be not compatible with brew install python
# areas I needed to clean before installation
# clean up ~/Library/Python
# clean up .local
# preconditions:
# xcode with command line tools installed
xcode-select --install
xqilla -i users.xml <(echo 'for $x in ./users/user return string-join((data($x/email), data($x/roles), data($x/last-login)),", ")') > users.csv
@munhitsu
munhitsu / .envrc
Created October 19, 2015 10:45
pyvenv/venv + direnv
if ! [ -d venv ]; then
pyvenv venv
fi
source venv/bin/activate

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 A1FD 1761 CF00 5402 C93C 5C1F 91FF 6CF6 C537 D591

To claim this, I am signing this object:

@munhitsu
munhitsu / gist:1034761
Created June 19, 2011 21:11
python 2.7 (*.dmg) uninstall from OSX
sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7
sudo rm -rf "/Applications/Python 2.7"
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' | cut -d " " -f 18 | xargs -IM sudo rm /usr/local/bin/M
echo based on http://stackoverflow.com/questions/3819449/how-to-uninstall-python-2-7-on-a-mac-os-x-10-6-4
@munhitsu
munhitsu / tickets.py
Created January 24, 2018 12:15
Zendesk tickets.xml to csv (opinionated)
import csv
import xml.etree.ElementTree as ET
# was: for $x in ./tickets/ticket return string-join((data($x/created-at), data($x/current-tags), data($x/subject), data($x/description), data($x/status-id)),", ")
SERVICE_ID = '31281329'
tree = ET.parse('tickets.xml')
root = tree.getroot()
@munhitsu
munhitsu / gist:56688bb6a9c7335d3023
Created June 30, 2014 16:58
breaking rabbitmq cluster
"""
Handy when you don't care about data and rabbitmq stopped working
$ rabbitmqctl add_vhost /sensu
Creating vhost "/sensu" ...
Error: {node_not_running,'rabbit@ip-X-Y-Z-A'}
$ rabbitmqctl cluster_status
Cluster status of node 'rabbit@ip-X-Y-Z-A' ...
[{nodes,[{unknown,['rabbit@ip-X-Y-Z-A']}]},{running_nodes,[]}]
@munhitsu
munhitsu / gist:3938829
Created October 23, 2012 13:45
augeas/augtool + puppet update /etc/hosts file
$puppetmaster_ip = '8.8.8.8'
augeas { "puppetmaster_in_hosts_append":
context => "/files/etc/hosts",
changes => [
"set 01/ipaddr '${puppetmaster_ip}'",
"set 01/canonical puppet",
],
onlyif => "match *[ipaddr = '${puppetmaster_ip}'] size == 0"
} -> augeas { "puppetmaster_in_hosts_update":
@munhitsu
munhitsu / gist:0d4b3d0dc6177620b8be
Last active March 8, 2016 16:04
docker commands
#nice docker stats
docker stats $(docker ps --format '{{.Names}}')
#old way
docker stats $(docker ps | awk '{if(NR>1) print $NF}')