Skip to content

Instantly share code, notes, and snippets.

CarrierWave.configure do |config|
if S3_SECRET && !Rails.env.test?
config.fog_provider = 'fog/aws'
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: S3_ACCESS_KEY,
aws_secret_access_key: S3_SECRET
}
config.fog_directory = S3_BUCKET
config.fog_public = true
function checkObj(checkProp) {
// We check that the object has a propery
if(myObj.hasOwnProperty(checkProp)) {
return myObj[checkProp];
}
// We did not find anything
return "Not Found";
}
@KensoDev
KensoDev / .tmux.conf
Created August 31, 2014 09:03
my tmux configuration
# use UTF8
set -g utf8
set-window-option -g utf8 on
# make tmux display things in 256 colors
set -g default-terminal "screen-256color"
set -g default-terminal "screen-256color"
# set scrollback history to 10000 (10k)
set -g history-limit 10000
TODO:
[] Add a login screen.
We use Auth0 for login, so we need to integrate the lock into the app.
When you are logged out, you will see the login screen. Once you login, we
store your token in local storage and you can see the other parts of the
application.
package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/Jeffail/gabs"
)
const COMMANDS = {
"1F": [3],
"1B": [5],
"1L": [11],
"1R": [13],
"1FR": [3, 13],
"1FL": [3, 11],
"1BR": [5, 13],
"1BL": [5, 11],
"2F": [18],
type AmazonResponse struct {
Reservations []Reservation `json:"Reservations"`
}
type Reservation struct {
Instances []Instace `json:"Instances"`
}
type Instance struct {
PublicIpAddres string `json:"PublicIpAddres"`
#!/usr/bin/python3
import pygame
import sys
class Game():
def __init__(self):
self._running = True
@KensoDev
KensoDev / cloudwatch-notification.json
Created April 17, 2017 17:47
Cloudwatch notification
{
"account": "{account-id}",
"detail": {
"clusterArn": "arn:aws:ecs:us-east-1:{account-id}:cluster/{cluster-id}",
"containerInstanceArn": "arn:aws:ecs:us-east-1:{account-id}:container-instance/0b1a4979-3846-4e3e-846f-b63a9ad545b0",
"containers": [
{
"containerArn": "arn:aws:ecs:us-east-1:{account-id}:container/4ce75a22-f1c9-4ac2-8607-a503e7682c1d",
"exitCode": 1,
"lastStatus": "STOPPED",
@KensoDev
KensoDev / notifications.tf
Created April 14, 2017 01:18
Cluster notification terraform
/*
Read more about event patterns here:
http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html
*/
data "template_file" "event_pattern" {
template = "${file("${path.module}/files/deploy-notification.json.tpl")}"
vars = {
cluster_arn = "${aws_ecs_cluster.ecs.id}"
}