Skip to content

Instantly share code, notes, and snippets.

@bobuss
bobuss / docker-compose.yml
Created October 14, 2023 00:20 — forked from gaieges/docker-compose.yml
Homeassistant with traefik 2.2 for TLS in docker-compose in network_mode: host
version: '2.1'
services:
homeassistant:
restart: always
image: homeassistant/raspberrypi3-homeassistant
expose:
- 8123
ports:
- "8123:8123"
@bobuss
bobuss / logrotate.cron
Last active August 29, 2015 14:22
logrotate template
#!/bin/sh
# Delete log files older than {{ daysdelete }} days
nice -n 19 find {{ logdirectory }} -type f -name "*.bz2" -mtime +{{ daysdelete }} -exec rm '{}' \; >/dev/null 2>&1
# Compress log files older than {{ dayscompress }} days
ionice -c3 nice -n 19 find {{ logdirectory }} -type f ! -path "*.bz2" ! -path "*.log" ! -path "*.gz" -mtime +{{ dayscompress }} -exec bzip2 '{}' \; >/dev/null 2>&1
# Reload rsyslog
/bin/kill -HUP $(cat /var/run/rsyslogd.pid)
@bobuss
bobuss / gist:988aaca32f5fbe6e73a9
Last active August 29, 2015 14:19
Raspberry recipies

Install a raspbian image on a sd-card, under Max OSX

Fast and clean !

$ df -h
Filesystem                                          Size   Used  Avail Capacity   iused     ifree %iused  Mounted on
/dev/disk1                                         465Gi  188Gi  276Gi    41%  49449884  72346210   41%   /
...
/dev/disk2s1 56Mi 14Mi 42Mi 26% 512 0 100% /Volumes/boot
@bobuss
bobuss / index.html
Last active August 29, 2015 14:16
index.html start file
<!DOCTYPE html>
<!-- Based on HTML5 Bones | http://html5bones.com -->
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page Title</title>
<meta name="description" content="">
@bobuss
bobuss / README.md
Last active May 3, 2018 07:27
Setup a Redis Cluster using docker-machine
@bobuss
bobuss / change_git_author
Created November 6, 2014 08:01
Change the git commits author
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
01:38,39,69,71,73,74
02:08,51,59,60,77,80
03:18,23,42,58,63,71
04:05,06,26,83,84
05:04,26,38,73
06:04,83
07:26,30,38,42,43,48,84
08:02,51,55
09:11,31,66
10:21,51,52,77,89
@bobuss
bobuss / logging.py
Created March 5, 2014 12:19
Send locals to your sentry server while an exception occurs
from __future__ import absolute_import
import pprint
from raven.handlers.logging import SentryHandler
class VerboseSentryHandler(SentryHandler, object):
"""
Subclass the SentryHandler in order to add the locals to the record
Inspired by The Verbose exception Formatter
From Bitly blog : http://word.bitly.com/post/69080588278/logging-locals
@bobuss
bobuss / Makefile
Created September 13, 2013 13:19
Makefile for python project continuous integration
ENV=env
SRC_CORE=src
CLOC=$(shell which cloc)
test-all: clean pep8 cloc init-coverage test-unit test-functionnal test-integration report-coverage flake8 lint clone
pep8:
$(ENV)/bin/pep8 --max-line-length=99 $(SRC_CORE) > pep8.log || :
@bobuss
bobuss / Calisthenics.md
Last active March 31, 2024 09:41
The 9 Rules of Object Calisthenics

Object Calisthenics outlines 9 basic rules to apply when performing the exercise:

  • One level of indentation per method.
  • Don't use the ELSE keyword.
  • Wrap all primitives and Strings in classes.
  • First class collections.
  • One dot per line.
  • Don't abbreviate.
  • Keep all classes less than 50 lines.
  • No classes with more than two instance variables.