Skip to content

Instantly share code, notes, and snippets.

@yannski
yannski / rename.rb
Created June 2, 2016 09:27
Rename S3 keys
require 'rubygems'
require 'aws-sdk'
access_key_id = ENV['AWS_ACCESS_KEY_ID']
secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
bucket = ENV['FOG_DIRECTORY']
region = ENV['FOG_REGION']
s3 = Aws::S3::Client.new(
region: region,
@yannski
yannski / index.erb
Last active February 24, 2016 16:53
ENSIIE 2°16 TP1
<html>
<head>
<title>Mon blog</title>
</head>
<body>
<% @articles.each{|article| %>
<h1><%= article[:title] %></h1>
<p><%= article[:body] %></p>
<a href='<%= article[:link] %>'>
Voir détails
@yannski
yannski / index.html
Created January 26, 2016 11:09
wekan deployment time enhancement on Scalingo
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,500,400italic,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
</head>
<body>
<img src="https://wekan.io/static/wekan-logo.png" style="height:30px;position:fixed;top:112px;left:15px;" />
<div style="display:block;width:500px;height:50px;border:#8bc34a solid 2px;position:fixed;top:100px;left:140px;">
<div style="display:block;position:absolute;top:0;bottom:0;left:0;right:0;background:repeating-linear-gradient(135deg,#ccc,#ccc 10px,white 10px,white 20px);opacity:0.3;">
</div>
@yannski
yannski / index.html
Created January 26, 2016 10:52
sample bar graph with striped background
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,500,400italic,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
</head>
<body>
<div style="display:block;width:500px;height:50px;border:#8bc34a solid 2px;background:linear-gradient(to right, #8bc34a 0%,#8bc34a 71%,white 71.1%,white 100%);position:fixed;top:100px;left:200px;">
<div style="display:block;width:2px;height:10px;background-color:8bc34a;position:absolute;top:-12px;left:70.5%;">
<div style="display:block;position:absolute;top:-16px;left:-18px;font-size:10px;font-family: 'Roboto';font-weight:300;">
2mn30s
</div>
require 'uri'
require 'open3'
namespace :scalingo do
namespace :mysql do
desc "Backup Scalingo MySQL database"
task backup: :environment do
app = ENV["APP"]
variable = ENV["DB_ENV_NAME"] || "SCALINGO_MYSQL_URL"
database, user, password = find_credentials_url(app, variable)
<p>Deploying various projects whose source is hosted on Github is now just one click away with our new “one-click deploy” feature.</p>
<img class="fullwidth" src="https://41.media.tumblr.com/e3638887f597460c024650c151565bd5/tumblr_inline_nzpeo9rKiT1sn0sdx_1280.jpg"></img>
[[MORE]]
<p>With this new feature, you just have to write a small JSON file placed at the root of your Github repository to make it an automatically deployable application on Scalingo.</p>
<h3>How does it work?</h3>
{
"name": "Telescope",
"description": "An open-source community app built with Meteor",
"repository": "https://github.com/TelescopeJS/sample-project/",
"logo": "http://www.telescopeapp.org/images/logo.png",
"website": "http://www.telescopeapp.org/",
"addons": ["scalingo-mongodb"]
}
@yannski
yannski / private_gem_on_scalingo.md
Last active October 16, 2015 15:11 — forked from masonforest/gist:4048732
Installing a Gem on Scalingo from a Private GitHub Repo

Installing a Gem on Scalingo from a Private GitHub Repo

Sometimes you want to use a gem on Scalingo that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

  1. Get an OAuth Token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note"

@yannski
yannski / script.rb
Created March 11, 2015 14:34
Ruby Cold Mailing
require 'mail'
require 'csv'
require 'pry'
require 'active_support'
require 'active_support/core_ext/object/blank'
Mail.defaults do
delivery_method :smtp, address: ENV["SMTP_HOST"], port: ENV["SMTP_PORT"], user_name: ENV["SMTP_USER_NAME"], password: ENV["SMTP_PASSWORD"], authentication: :plain, enable_starttls_auto: true
end
@yannski
yannski / test.md
Created February 16, 2015 16:46
test

Authentication

The authentication to the API is done thanks to an authentication token and Basic HTTP Auth. The API is HTTPS only, so credentials are always sent encrypted.