Skip to content

Instantly share code, notes, and snippets.

View Mazyod's full-sized avatar
🔬
R&D

Maz Mazyod

🔬
R&D
View GitHub Profile
@mrw34
mrw34 / postgres.sh
Last active June 4, 2024 09:31
Enabling SSL for PostgreSQL in Docker
#!/bin/bash
set -euo pipefail
openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req -keyout privkey.pem
openssl rsa -in privkey.pem -passin pass:abcd -out server.key
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod 600 server.key
test $(uname -s) = Linux && chown 70 server.key
docker run -d --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust -v "$(pwd)/server.crt:/var/lib/postgresql/server.crt:ro" -v "$(pwd)/server.key:/var/lib/postgresql/server.key:ro" postgres:12-alpine -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key
@Mazyod
Mazyod / watchdog.py
Last active April 13, 2019 15:26
Directory/files watchdog in Python
import os
import logging
from queue import Queue, Empty as EmptyQueue
from time import sleep
from threading import Thread
from typing import List
logger = logging.getLogger("watchdog")
import React, { Component } from 'react';
import PropTypes from 'prop-types';
const propTypes = {
text: PropTypes.string.isRequired,
customClass: PropTypes.string,
selectionHandler: PropTypes.func
};
/**
@alexa-infra
alexa-infra / examples.py
Created May 22, 2020 21:27
Dialect-specific SQLAlchemy declarative Column defaults
class Table1(Base):
__tablename__ = 'table1'
id = sa.Column(UUID, primary_key=True, server_default=sa.text("uuid_generate_v4()"))
class Table2(Base):
__tablename__ = 'table2'
id = sa.Column(UUID, primary_key=True, default=uuid.uuid4)
@webbertakken
webbertakken / .gitattributes
Last active March 19, 2024 17:46
.gitattributes for Unity projects
#
# Git attributes for Unity projects
#
# Compiled by the GameCI community under the MIT license - https://game.ci
#
# Latest version at https://gist.github.com/webbertakken/ff250a0d5e59a8aae961c2e509c07fbc
#
# Ensure that text files that any contributor introduces to the repository have their line endings normalized
* text=auto