Skip to content

Instantly share code, notes, and snippets.

@kosyfrances
kosyfrances / terraform_template_to_file
Created November 29, 2019 13:10
Render terraform template to local file tested on Terraform v0.12.16
locals {
our_rendered_content = templatefile("${path.module}/yourtemplatefile.tmpl", { yourvars = var.yourvars })
}
resource "null_resource" "local" {
triggers = {
template = local.our_rendered_content
}
# Render to local file on machine
@kosyfrances
kosyfrances / README.md
Created February 21, 2019 13:36 — forked from johananl/README.md
KVM in runc

KVM in runc

Running a KVM virtual machine inside a runc contianer.

Requirements

  • A host which can run KVM virtual machines using Vagrant.

Setting up a test VM

@kosyfrances
kosyfrances / site-to-site.md
Last active April 19, 2024 17:10
Steps to set up one tunnel IPSec Site to site VPN on AWS and a VM on another cloud provider (Packet) running Strongswan
@kosyfrances
kosyfrances / libvirt-kvm-docker.md
Last active February 2, 2023 16:32
Spin up a Libvirt VM (that supports nested virtualisation using KVM as Hypervisor) in a docker container.

Dockerfile

FROM ubuntu:18.04
RUN apt-get update -y && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils vagrant && \
    apt-get autoclean && \
    apt-get autoremove && \
    vagrant plugin install vagrant-libvirt
COPY startup.sh /
ENTRYPOINT ["/startup.sh" ]

If you are like me you find yourself cloning a repo, making some proposed changes and then deciding to later contributing back using the GitHub Flow convention. Below is a set of instructions I've developed for myself on how to deal with this scenario and an explanation of why it matters based on jagregory's gist.

To follow GitHub flow you should really have created a fork initially as a public representation of the forked repository and the clone that instead. My understanding is that the typical setup would have your local repository pointing to your fork as origin and the original forked repository as upstream so that you can use these keywords in other git commands.

  1. Clone some repo (you've probably already done this step).

    git clone git@github...some-repo.git
@kosyfrances
kosyfrances / git_olduser_403.md
Created June 15, 2016 19:30
Pushing to Git returned error 403 with old git username instead of new

When I tried to push to Github, it gave me this error.

remote: Permission to NEWUSER/NEWREPO.git denied to OLDUSER. 
fatal: unable to access ‘https://github.com/NEWUSER/NEWREPO.git/': The requested URL returned error: 403

But setting the user.name and email globally should have fixed it, No it did not. So I got it fixed by deleting the OLDUSER associated with GitHub from Keychain Access app under Passwords section. Then the push command went successful. :)

@kosyfrances
kosyfrances / ansible_unknown_encoding.md
Created May 8, 2016 20:40
Running ansible playbook gives unknown encoding error

While running ansible playbook, I encountered this error

Traceback (most recent call last):
  File "/usr/local/bin/ansible-playbook", line 110, in <module>
    display.error("Unexpected Exception: %s" % to_unicode(e), wrap_text=False)
  File "/Library/Python/2.7/site-packages/ansible/utils/display.py", line 261, in error
    self.display(new_msg, color=C.COLOR_ERROR, stderr=True)
  File "/Library/Python/2.7/site-packages/ansible/utils/display.py", line 124, in display
    msg2 = to_bytes(msg2, encoding=self._output_encoding(stderr=stderr))
 File "/Library/Python/2.7/site-packages/ansible/utils/unicode.py", line 208, in to_bytes
@kosyfrances
kosyfrances / mysql_docker.md
Last active April 5, 2016 15:12
MYSQL server in docker container failed to start

Mysql failed to start, and I got these errors

160405  8:58:33  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
160405 08:58:33 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
@kosyfrances
kosyfrances / self_signed_ssl.md
Last active March 16, 2016 15:37
How to create self signed SSL certificate on Nginx for Ubuntu 14.04

Create the SSL certificate -
Let us make a directory to store all our ssl configuration.

sudo mkdir /etc/nginx/ssl

Next, create the key -

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt

These options will create both a key file and a certificate.

@kosyfrances
kosyfrances / nginx_virtual_host.md
Last active August 19, 2017 19:39
How To SetUp NGINX VirtualHosts on Ubuntu 14.04

#Set up nginx virtual host on Ubuntu 14.04

In this example, we will create a website called devops.com and create site to publish "Hello World!"
We are assuming you have nginx installed. If not, follow the steps here to install nginx .   We want to make the necessary directories in /var/www folder.

sudo mkdir -p /var/www/devops.com/httpdocs

And we want to write Hello world! in Index.html file.