Skip to content

Instantly share code, notes, and snippets.

@xydinesh
xydinesh / nginx.conf
Created February 1, 2018 22:01 — forked from bsergean/nginx.conf
Simple nginx.conf file
#
# Run in the foreground locally
# nginx -p . -c nginx.conf
#
worker_processes 1;
daemon off;
error_log nginx_error.log;
events {
worker_connections 1024;
@xydinesh
xydinesh / nginxproxy.md
Created January 25, 2018 00:40 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

import hashlib as hasher
import datetime as date
# Define what a Snakecoin block is
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = previous_hash
@xydinesh
xydinesh / site.pp
Created January 27, 2017 14:21 — forked from jordansissel/site.pp
Simplest example of a masterless puppet invocation using module paths
include foo
@xydinesh
xydinesh / README.md
Created January 25, 2017 05:15 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index:

Intermediate CA Signing with Puppet

Problem statement

Many sites have a requirement to use an enterprise-wide certificate authority. They either have a "real" signing cert that chains to a public root CA or an internal root (usually air-gapped) which only signs issuing CA certificates, one per PKI application.

Puppet does not have a currently supported configuration which fits into this model. The [existing documentation][existing] describes using an "external CA" instead of Puppet's internally generated CA (which is a combined self-signed Root and issuing CA in one), but requires that the user turn off Puppet's issuance code and leaves the whole certificate generation and distribution workflow as an "exercise to the reader".

The procedure in this document describes a supportable configuration which bridges the gap between these two positions: it is possible to use Puppet's internal signing code to issue certificates from an intermediate CA cert which was externally generated and signed. There are a

@xydinesh
xydinesh / openstack_security_group_rules.py
Created October 7, 2016 21:17
Move security group rules from AWS to Openstack.
from keystoneauth1 import loading
from keystoneauth1 import session
from novaclient import client as novaclient
import boto3
def get_session():
loader = loading.get_plugin_loader('password')
auth = loader.load_from_options(
auth_url='https://auth_url',
@xydinesh
xydinesh / README.md
Last active August 29, 2015 14:24 — forked from inklesspen/README.md

(This gist is pretty old; I've written up my current approach to the Pyramid integration on this blog post, but that blog post doesn't go into the transactional management, so you may still find this useful.)

Fast and flexible unit tests with live Postgres databases and fixtures

I've created a Pyramid scaffold which integrates Alembic, a migration tool, with the standard SQLAlchemy scaffold. (It also configures the Mako template system, because I prefer Mako.)

I am also using PostgreSQL for my database. PostgreSQL supports nested transactions. This means I can setup the tables at the beginning of the test session, then start a transaction before each test happens and roll it back after the test; in turn, this means my tests operate in the same environment I expect to use in production, but they are also fast.

I based my approach on [sontek's blog post](http://sontek.net/blog/

import unittest
from pyramid import testing
from paste.deploy.loadwsgi import appconfig
from webtest import TestApp
from mock import Mock
from sqlalchemy import engine_from_config
from sqlalchemy.orm import sessionmaker
from app.db import Session