Skip to content

Instantly share code, notes, and snippets.

View mathieue's full-sized avatar

Mathieu Elie mathieue

View GitHub Profile
@markfickett
markfickett / fht_curses_graph
Last active June 20, 2017 16:43
ArduinoFHT Demo Graph (Python using curses)
"""Draw a live bar graph of frequency data (from Arduino FHT)."""
import collections
import curses
import math
import serial # http://pyserial.sourceforge.net/
import time
_SERIAL_DEVICE = '/dev/tty.usbmodemfa141'
_GRAPH_MAX_Y = 100
@chut
chut / xively mqtt arduino
Created October 16, 2013 16:52
An example of how to connect to the xively MQTT server using arduino. Based on the pubsub client by knolleary
/*
Xively MQTT example
-Subscribes to Xively feed
-publishes current value to serial monitor
Based on Basic MQTT Example by knolleary
By Calum Barnes, Xively (c) 2013
@xively-gists
xively-gists / WiFiXivelyTutorial.ino
Last active December 17, 2015 05:58
Arduino wifi tutorial code
/*
##Xively WiFi Sensor Tutorial##
This sketch is designed to take sensors (from photocell) and upload the values to Xively
at consistant intervals. At the same time it gets a setable value from Xively to adjust the brigthness
of an LED. This sketch is reusable and can be adapted for use with many different sensors.
Derived from Xively Ardino Sensor Client by Sam Mulube.
By Calum Barnes 3-4-2013
BSD 3-Clause License - [http://opensource.org/licenses/BSD-3-Clause]
Copyright (c) 2013 Calum Barnes
@mikhailov
mikhailov / 0. nginx_setup.sh
Last active April 2, 2024 14:57
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@thbar
thbar / README.MD
Created April 18, 2012 09:43
Ruby JSON pipe pretty-printer

A quick ruby command line to pretty-print piped json.

Usage

Put this somewhere in your path, with chmod +x, then:

curl http://myapp.com/stuff.json | json

@codingjester
codingjester / duckduckgo.rb
Created January 14, 2012 19:28
DuckDuckGo Ruby API
require 'net/http'; require 'json'; JSON.parse(Net::HTTP.get(URI("http://duckduckgo.com/?q=#{query}&o=json")))
@markoa
markoa / deploy.rb
Created October 10, 2011 13:31
Ingredients to monitor Resque with God automatically via Capistrano (on Ubuntu)
namespace :deploy do
desc "Hot-reload God configuration for the Resque worker"
task :reload_god_config do
sudo "god stop resque"
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}"
sudo "god start resque"
end
end
# append to the bottom:
@mathieue
mathieue / rmvm-system-wide.sh
Created September 9, 2011 21:23
System wide RVM
sudo su
bash <<(curl -s https://rvm.beginrescueend.com/install/rvm)
apt-get install zlib1g-dev libssl-dev libreadline5-dev
rvm install 1.9.2
rvm 1.9.2
add rvm script below to your .bashrc and to /root/.bashrc
# Load RVM if it is installed,
# first try to load user install
# then try to load root install, if user install is not there.
@bcg
bcg / client.rb
Created April 6, 2011 20:46
Eventmachine + ZMQ + Redis Server
require 'em-zeromq'
Thread.abort_on_exception = true
EM.run do
ctx = EM::ZeroMQ::Context.new(1)
socket = ctx.connect( ZMQ::PUSH, 'tcp://127.0.0.1:15000')
loop do # ZOMG you are blocking!?
@mmai
mmai / gist:734893
Created December 9, 2010 16:04
Trouve les tweets de Centquarante ne contenant pas 140 caractères
#Trouve les tweets de Centquarante contenant un nombre de caractères différent de 140
#cf. http://twitter.com/#!/Centquarante/status/12787915516026880
#ruby 1.9 requis pour la détection automatique de l'encodage
require 'twitter'
def get_tweets(user, options)
lastid = false
Twitter.user_timeline(user, options).each do |r|
puts r.text.size.to_s + ":#{r.id}:#{r.text}" if r.text.size != 140