Skip to content

Instantly share code, notes, and snippets.

View lemmycaution's full-sized avatar
🐰
eating carrots

onur uyar lemmycaution

🐰
eating carrots
View GitHub Profile
require 'active_support/time'
require 'active_support/duration'
require 'test/unit'
def process events
sorted_events = events.sort_by{ |e| e[:start_at] }
point_in_time = Time.now.utc.beginning_of_day
results = []
sorted_events.each do |event|
start_at = event[:start_at].utc
// (Based on Ethernet's WebClient Example)
#include <SPI.h>
#include <WiFly.h>
#include "Credentials.h"
#define RESETLEDPin 13
#define RESETPIN 13
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:gml="http://www.opengis.net/gml" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" version="2.0">
<channel>
<title>Science: Science Weekly | theguardian.com</title>
<link>http://www.theguardian.com/science/series/science</link>
<description>Alok Jha and the Guardian's science team bring you the best analysis and interviews from the worlds of science and technology</description>
<language>en-gb</language>
<copyright>Guardian News and Media Limited or its affiliated companies. All rights reserved. 2013</copyright>
<lastBuildDate>Sun, 28 Jul 2013 23:05:21 GMT</lastBuildDate>
<doc
@lemmycaution
lemmycaution / gist:3409c6af7b4468385ba9
Created April 2, 2015 17:18
ffmpeg install ubunt
apt-get update -y --force-yes && apt-get -y --force-yes install software-properties-common python-software-properties && add-apt-repository -y ppa:mc3man/trusty-media && apt-get -y --force-yes update && apt-get -y --force-yes dist-upgrade && apt-get -y --force-yes install ffmpeg
@lemmycaution
lemmycaution / natural_input.js
Last active August 29, 2015 14:17
natural input parser
var NaturalInput = (function (){
function NaturalInput(text) {
this.position = 0;
this.text = text;
this.requirements = this.text.match(/\$\w*/g);
this.suggestions = [];
this.data = {};
this.requirements.forEach((function(req) {
@lemmycaution
lemmycaution / bsd_client.rb
Created September 30, 2014 16:12
ruby bsd api client page/api/signup/process_signup implementation
require 'httparty'
require 'openssl'
require 'ox'
##
# Very simple http client to process signups on BSD API
# You need to set ENV vars before start using it
# BSD_API_HOST, BSD_APP_ID, BSD_APP_SECRET, BSD_FORM_ID
class BSDClient
#!/usr/bin/env bash
user="$1"
if [ -z "$user" ]; then
user=ubuntu
fi
# Enable memory cgroup and swap accounting
sed -i 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"/g' /etc/default/grub
update-grub
# Available versions: http://downloads.eucalyptus.com/software/euca2ools/2.0/source/
export VERSION="2.0.0"
export WORKING_DIR=tmp/euca2install
mkdir -p ${WORKING_DIR}
cd ${WORKING_DIR}
# install dependencies
# you can also use port instead: sudo port install swig-python
brew install swig
brew install wget
@lemmycaution
lemmycaution / gist:7268194
Created November 1, 2013 16:44
Simple Dummy Dirty Twitter Bot
require 'twitter'
require 'awesome_print'
@rest = Twitter::REST::Client.new do |config|
config.consumer_key = "XXX"
config.consumer_secret = "XXX"
config.access_token = "XXX-XXX"
config.access_token_secret = "XXX"
end
#!/usr/bin/env ruby
require 'rubygems'
require 'chatterbot/dsl'
#
# this is the script for the twitter bot johnydoster
# generated on 2013-11-01 15:41:39 +0000
#