Skip to content

Instantly share code, notes, and snippets.

View cyakimov's full-sized avatar
🏠
Working from home

Carlos Yakimov cyakimov

🏠
Working from home
  • Falabella
  • Santiago, Chile
View GitHub Profile
# file name: terraform/env-staging/peering.tf
# No peering / direct connectivity between staging and prod, for safety.
resource "terraform_remote_state" "dev_state" {
backend = "s3"
config {
bucket = "${var.tf_s3_bucket}"
region = "${var.region}"
key = "${var.dev_state_file}"
}
# snippet from terraform/env-dev/peering.tf
# import staging state, add routes from dev to staging
resource "terraform_remote_state" "staging_state" {
backend = "s3"
config {
bucket = "${var.tf_s3_bucket}"
region = "${var.region}"
key = "${var.staging_state_file}"
}
# file name: infra/terraform/modules/aws_vpc/bastion_sg.tf
resource "aws_security_group" "bastion_ssh_sg" {
name = "bastion_ssh"
description = "Allow ssh to bastion hosts for each vpc from anywhere"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
@cyakimov
cyakimov / Myapp.php
Created November 16, 2015 15:42 — forked from stevethomas/Myapp.php
Example of how to extend Lumen monolog implementation for New Relic and potentially other handlers
<?php namespace Foo;
// app/Myapp.php
use Monolog\Logger;
use Laravel\Lumen\Application;
use Monolog\Handler\StreamHandler;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\NewRelicHandler;
class Myapp extends Application
@cyakimov
cyakimov / Vagrantfile
Last active August 29, 2015 14:22 — forked from dhrrgn/Vagrantfile
# ...
config.vm.provider :virtualbox do |v|
# ... Other stuff here
# Set the timesync threshold to 10 seconds, instead of the default 20 minutes.
v.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000]
end
# ...

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@cyakimov
cyakimov / gist:bc2b1cdb3c7eb1d0cd9b
Created May 20, 2015 14:13
jQuery plugin for equal height elements
$.fn.setSameHeight = function () {
var arrHeights = this.map(function (i, el) {
return $(el).height();
});
var maxHeight = Math.max.apply(null, arrHeights);
this.height(maxHeight);
return this;

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@cyakimov
cyakimov / gist:8010474
Created December 17, 2013 18:49
Horizontal line with text in the middle.
<style>
.divider {
width:100%;
text-align:center;
border-bottom: 1px solid #000;
line-height:0.1em;
margin:10px 0 20px;
}
.divider > span { background:#fff; padding:0 10px; }
</style>