$ uname -r
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# This is how I used it: | |
# $ cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history | |
import sys | |
import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SENTRY_SECRET_KEY=longsecrethere | |
DOCKERPREFIX=eric | |
cat <<-EOF > requirements.txt | |
sentry-slack==0.5.0 | |
EOF | |
cat <<-EOF > Dockerfile | |
FROM sentry:8.5-onbuild | |
EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redis: | |
image: redis | |
postgres: | |
image: postgres:9.4 | |
environment: | |
- POSTGRES_USER:sentry | |
- POSTGRES_PASSWORD:sentry | |
volumes: | |
- /var/data/sentry/postgre:/var/lib/postgresql/data:rw |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Filter for all lines not containing the string ',KG,' | |
^((?!,KG,).)*$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import chain | |
from django.db.models.fields.related import ManyToManyField | |
def model_to_dict_verbose(instance, fields=None, exclude=None): | |
""" | |
Returns a dict containing the data in ``instance`` suitable for passing as | |
a Form's ``initial`` keyword argument. Keys in dict are exchanged for | |
verbose names contained in the model. | |
``fields`` is an optional list of field names. If provided, only the named | |
fields will be included in the returned dict. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enumerable.Range(1, 30).Select(num => | |
((Func<string[], string>) | |
(buzz => new string[]{ | |
buzz[((num + 2) % 3) / 2] + | |
buzz[((num + 4) % 5) / 4 * 2], | |
""+num | |
}.First(r => r != "")))(new[] { null, "fizz", "buzz"}) | |
).ToList().ForEach(s => Console.WriteLine(s)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
# Install kernel extra's to enable docker aufs support | |
# sudo apt-get -y install linux-image-extra-$(uname -r) | |
# Add Docker PPA and install latest version | |
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## Copy & Paste Tool for images to PowerPoint(.pptx) | |
## | |
import pptx | |
import pptx.util | |
import glob | |
import scipy.misc | |
OUTPUT_TAG = "MY_TAG" |