Skip to content

Instantly share code, notes, and snippets.

View iamralch's full-sized avatar

Svetlin Ralchev iamralch

View GitHub Profile
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active January 9, 2025 12:22
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@voondo
voondo / scaleway-inventory.rb
Created February 19, 2016 11:11
Scaleway ansible dynamic inventory
#!/bin/ruby
require 'json'
require 'optparse'
require 'net/http'
require 'pry'
require 'yaml'
auth_token = ENV['SCALEWAY_AUTH_TOKEN']
uri = URI('https://api.scaleway.com/servers')
@mauvm
mauvm / Jasmine-and-Babel6.md
Created November 12, 2015 10:51
Jasmine ES6 run script for use with Babel 6
$ npm install --save babel-cli babel-preset-es2015
$ npm install --save-dev jasmine

.babelrc:

{
 "presets": ["es2015"]
@popravich
popravich / PostgreSQL_index_naming.rst
Last active January 6, 2025 08:57
PostgreSQL index naming convention to remember

The standard names for indexes in PostgreSQL are:

{tablename}_{columnname(s)}_{suffix}

where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;
@paulirish
paulirish / what-forces-layout.md
Last active April 24, 2025 09:45
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@donpdonp
donpdonp / boom!
Created July 23, 2015 15:41
DigitalOcean + CoreOS with Terraform
$ ssh [email protected]
Warning: Permanently added '45.55.11.xxx' (ED25519) to the list of known hosts.
CoreOS stable (717.3.0)
core@rethink-cluster-sfo1 ~ $
@bruth
bruth / README.md
Last active November 20, 2024 04:58
SQLite update hook example in Go

SQLite Update Hook Example

This is an example usage of registering an update_hook to a SQLite connection. The motivation for exploring this feature is to test out various implementations of data monitoring interfaces.

A few notable properties of the implementation:

  • The hook must be registered on the connection being used which requires clients to manually integrate this code.
  • Each INSERT and UPDATE operation requires a subsequent SELECT to get the row data.
  • When registering the hook, increasing the bufsize under heavy workloads will improve throughput, but the SQLite library is single-threaded by design.
@PurpleBooth
PurpleBooth / README-Template.md
Last active April 24, 2025 18:58
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@adamJLev
adamJLev / fields.py
Created June 5, 2015 18:43
Stripe-style short alphanumeric UUID fields
from django.db.models import SubfieldBase
from django.core.exceptions import ImproperlyConfigured
from django_extensions.db.fields import ShortUUIDField
class XidField(ShortUUIDField):
"""
XID stands for external ID.
Randomly generated IDs (base62 encoded UUID) used for public display purposes.
The random ID gets a short textual prefix for improved legibility, like Stripe's IDs.