Skip to content

Instantly share code, notes, and snippets.

View Atala's full-sized avatar

Aloïs Guillopé Atala

View GitHub Profile
@katylava
katylava / Dockerfile
Last active March 27, 2023 18:09
docker-compose with Django and ipdb
FROM python:3.5.1
MAINTAINER Katy Lavallee <katylava@gmail.com>
RUN mkdir -p /dockeripdb/
ENTRYPOINT ["/usr/local/bin/python"]
WORKDIR /dockeripdb/
ENV PYTHONPATH /dockeripdb/
ENV DJANGO_SETTINGS_MODULE dockeripdb.settings
@sindresorhus
sindresorhus / post-merge
Last active February 14, 2024 06:20
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@shevron
shevron / LICENSE
Last active April 28, 2020 02:28
Send EC2 instance memory usage stats to CloudWatch using boto and IAM Roles
Copyright (c) 2015, Shahar Evron
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
@epicserve
epicserve / redis_key_sizes.sh
Last active February 21, 2024 18:30
A simple script to print the size of all your Redis keys.
#!/usr/bin/env bash
# This script prints out all of your Redis keys and their size in a human readable format
# Copyright 2013 Brent O'Connor
# License: http://www.apache.org/licenses/LICENSE-2.0
human_size() {
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } '
}
@reimund
reimund / dict2xml.py
Last active December 25, 2023 06:09
Simple dictionary to xml serializer.
"""
Simple xml serializer.
@author Reimund Trost 2013
Example:
mydict = {
'name': 'The Andersson\'s',
'size': 4,
@gawen
gawen / gevent_watchdog.py
Created April 11, 2012 12:58
Python Watchdog with gevent
""" Use watchdogs to make your code safer. (http://en.wikipedia.org/wiki/Watchdog_timer)
Usage:
with watchdog.Watchdog(duration = 1.0):
# Some code which takes less than 1s
# If it takes more, the exception Watchdog.Reset will be raised
# To notify the watchdog the section is still alive, call the method
# 'tick' to reset its internal timer.