- Add Heroku to your Gemfile and
bundle install. - Create your Heroku app. This will only work with their (currently-beta)
'cedar' stack, so you have to
heroku create --stack=cedar. - Create a Procfile for your bot. This tells Heroku how to run your worker. In
our case, the bot is bot.rb, so the only line in the Procfile is
cinch: bundle exec ./bot.rb - Commit and push to Heroku.
- You do not want a Web worker running, so
heroku scale web=0 cinch=1. This also sets up your deployments to restart the bot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(get_feed_srv). | |
| -behaviour(gen_server). | |
| -define(SERVER, ?MODULE). | |
| %% ------------------------------------------------------------------ | |
| %% API Function Exports | |
| %% ------------------------------------------------------------------ | |
| %%-export([start_link/0, get_feed/1, process_redirect/1, process_response/1]). | |
| -export([start_link/0, get_feed/1]). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(date_util). | |
| -compile(export_all). | |
| epoch() -> | |
| now_to_seconds(now()) | |
| . | |
| epoch_hires() -> | |
| now_to_seconds_hires(now()) | |
| . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Pull this file down, make it executable and run it with sudo | |
| # wget https://gist.githubusercontent.com/rlander/7db38d57166f55c06fcf/raw/b4edf4c6fd39c604392a96ce6ff21953ff941e51/build-erlang-17.sh | |
| # chmod u+x build-erlang-17.sh | |
| # sudo ./build-erlang-17.sh | |
| if [ $(id -u) != "0" ]; then | |
| echo "You must be the superuser to run this script" >&2 | |
| exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require! <[ watchify browserify gulp ]> | |
| require! 'vinyl-source-stream': source | |
| require! 'vinyl-buffer': buffer | |
| require! 'gulp-util': gutil | |
| require! 'liveify' | |
| gulp.task \bundle !-> | |
| bundler = watchify browserify {} <<< watchify.args <<< | |
| entries: ['./src/index.ls'] | |
| debug: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| # see: http://wiki.nginx.org/Pitfalls | |
| # see: http://wiki.nginx.org/IfIsEvil | |
| listen 80; | |
| root /app; | |
| index index.html index.htm index.php; | |
| error_page 404 /index.php; | |
| # Make site accessible from http://set-ip-address.xip.io |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Create a dummy analytics object until real loaded | |
| window.analytics || (window.analytics = []); | |
| window.analytics.methods = ['identify', 'track', 'trackLink', 'trackForm', 'trackClick', 'trackSubmit', 'page', 'pageview', 'ab', 'alias', 'ready', 'group', 'on', 'once', 'off']; | |
| window.analytics.factory = function(method) { | |
| return function() { | |
| var args = Array.prototype.slice.call(arguments); | |
| args.unshift(method); | |
| window.analytics.push(args); | |
| return window.analytics; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| check process redis-server | |
| with pidfile "/var/run/redis.pid" | |
| start program = "/etc/init.d/redis-server start" | |
| stop program = "/etc/init.d/redis-server stop" | |
| if 2 restarts within 3 cycles then timeout | |
| if totalmem > 100 Mb then alert | |
| if children > 255 for 5 cycles then stop | |
| if cpu usage > 95% for 3 cycles then restart | |
| if failed host 127.0.0.1 port 6379 then restart | |
| if 5 restarts within 5 cycles then timeout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import os | |
| import csv | |
| import collections | |
| from datetime import datetime | |
| from peewee import * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| {I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It | |
| is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as | |
| you did, the {internet|net|web} will be {much more|a lot more} | |
| useful than ever before.| | |
| I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!| | |
| {I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} | |
| your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any? | |
| {Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe. | |
| Thanks.| |