Skip to content

Instantly share code, notes, and snippets.

View penso's full-sized avatar

Fabien Penso penso

View GitHub Profile
bind: 0.0.0.0
port: 8125
root: tmp/statsd
redis:
host: 127.0.0.1
port: 6379
retentions:
1: 600
10: 360
60: 10080 # 1 week
@penso
penso / README.md
Last active December 15, 2015 08:09
Configuration on my Raspberry

NGINX Installation

apt-get install nginx apache2-utils rsync

Add a password : sudo htpasswd /etc/htpasswd

Motion Installation

apt-get install motion

@penso
penso / copy-file.sh
Last active December 15, 2015 06:59
How to copy automatically your motion files remotely, creating directory if needed
#!/bin/bash
# create ~motion/cam/ on your server,
# create a local ssh key, connect once to make sure it works
# set the following line in motion.conf
# on_movie_end /home/motion/copy-file.sh %f
# on_picture_save /home/motion/copy-file.sh %f
# movie_filename %Y/%m/%d/%v-%H%M%S
# target_dir /home/motion/
@penso
penso / gist:5217020
Created March 21, 2013 21:36
FS error on my Raspberry PI
86141.335295] mmc0: Timeout waiting for hardware interrupt - cmd25.
[86141.338742] mmcblk0: error -110 transferring data, sector 1699824, nr 80, cmd response 0x900, card status 0xc00
[86141.339611] end_request: I/O error, dev mmcblk0, sector 1699832
[86141.339670] end_request: I/O error, dev mmcblk0, sector 1699840
[86141.339692] end_request: I/O error, dev mmcblk0, sector 1699848
[86141.339711] end_request: I/O error, dev mmcblk0, sector 1699856
[86141.339756] end_request: I/O error, dev mmcblk0, sector 1699864
[86141.339778] end_request: I/O error, dev mmcblk0, sector 1699872
[86141.339795] end_request: I/O error, dev mmcblk0, sector 1699880
[86141.339812] end_request: I/O error, dev mmcblk0, sector 1699888
@penso
penso / kill-passenger-memory
Created March 18, 2013 09:03
kill-stale-resque.sh
#!/bin/bash
# Simple script to kill stale resque workers
# Adam St. John <astjohn@gmail.com>
# 2011-06-24
# Timeout set to 10 minutes
TIMEOUT=300
# 21028 resque-1.16.1: Forked 17674 at 1308879414
@penso
penso / gist:5173885
Created March 15, 2013 23:07
List Debian packages from deleted repositories
apt-show-versions | grep 'No available'
@penso
penso / gist:4971414
Last active December 13, 2015 20:38
iOS versions running Push4.0 ( available at http://2apn.com )
4.2.10: 1 0.01%
3.2.1: 1 0.01%
4.2: 1 0.01%
3.2.2: 4 0.05%
4.0.1: 4 0.05%
4.0: 4 0.05%
4.3: 4 0.05%
4.3.2: 5 0.06%
4.3.1: 11 0.13%
5.0: 12 0.14%
@penso
penso / gist:4687247
Last active December 12, 2015 00:58
How to have a system-wide unsubscribe system. EmailSettings holds the email address, and the reason (bounce, unsubscribe, etc).
class PushMailerInterceptor
def self.delivering_email(message)
StatStore.incr("push_mailer".to_sym)
message.destinations.each do |recipient|
if EmailSetting.find_by_email(recipient)
message.perform_deliveries = false
end
end
end
end
Subject: Fabien, how could I have done better?
Hello Fabien,
You've decided to leave the Sunrise club. We miss you already.
I would like to know if there is anything I can do to convince you to come back. Tell me about the one thing that you wish we would change.
Your feedback is very valuable to me and the team and I am looking forward to hear from you.
@penso
penso / gist:4668886
Last active December 11, 2015 22:19
Models:
class Push < ActiveRecord::Base
belongs_to :user
end
class User < ActiveRecord::Base
has_many :pushes
end