Skip to content

Instantly share code, notes, and snippets.

@l3th2nh
l3th2nh / README.md
Created July 11, 2023 13:32 — forked from JosimarCamargo/README.md
How to setup a Postgres replication with docker and docker-compose

How to setup a Postgres replication with docker and docker-compose

How to use

To run you will need docker and docker-compose installed, and run the command docker-compose up on a folder within this file named docker-compose.yml(attached in this Gist)

How the PGAudit is enable, you will see the queries log and in which database is running which query, this is the main purpose of this Gist, along with have a database with replication working out of the box

To add user with just reading rights to access the database on slave replica

@l3th2nh
l3th2nh / _0__ssl_certbot_letsencrypt.md
Created July 10, 2023 10:18 — forked from maxivak/_0__ssl_certbot_letsencrypt.md
Let's encrypt SSL certificates using certbot in docker

Directories on host machine:

  • /data/certbot/letsencrypt

  • /data/certbot/www

  • Nginx server in docker container

docker run -d --name nginx \
@l3th2nh
l3th2nh / docker-save
Created August 27, 2021 17:38 — forked from kingletas/docker-save
Save all of containers and images to specific directories
#!/bin/bash
_images_directory="images.d"
_containers_directory="containers.d"
_DIRS=( "$_images_directory" "$_containers_directory" )
for dir in "${_DIRS[@]}"; do
if [ ! -d "$dir" ]; then
mkdir "$dir"
fi
done
@l3th2nh
l3th2nh / gist:8f12d345c03b2fc65959c60d0c3a00a9
Created August 27, 2021 17:30 — forked from Ratler/gist:7756deecc330db9ce07a
A few quick bash one-liners to export/save import/load docker containers/images

NOTE: make sure you export containers and images in separate directories or it's very likely there will be issues when importing or loading your backups using the following snippets

Export all containers

$ while read image container_id; do 
    docker export $container_id > ${image////_}-${container_id}.tar 
 done < <(docker ps -a -f status=exited | tail -n +2 | awk '{ print $2 " " $1 }')
@l3th2nh
l3th2nh / innosample.pas
Created August 1, 2021 12:41 — forked from lextm/innosample.pas
Inno Setup script sample for advanced part 3
function Count(What, Where: String): Integer;
begin
Result := 0;
if Length(What) = 0 then
exit;
while Pos(What,Where)>0 do
begin
Where := Copy(Where,Pos(What,Where)+Length(What),Length(Where));
Result := Result + 1;
end;
@l3th2nh
l3th2nh / jsonParser.bat
Created July 7, 2021 20:20 — forked from navono/jsonParser.bat
parse JSON file by windows batch
:: Read file "package.json" into variable string, removing line breaks.
set string=
for /f "delims=" %%x in (package.json) do set "string=!string!%%x"
rem Remove quotes
set string=%string:"=%
rem Remove braces
set "string=%string:~2,-2%"
rem Change colon+space by equal-sign
set "string=%string:: ==%"
@l3th2nh
l3th2nh / Blocks.md
Created March 17, 2020 16:24 — forked from bdlangton/Blocks.md
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@l3th2nh
l3th2nh / domain-to-aws-ec2-instance.md
Created January 4, 2019 02:33 — forked from keithweaver/domain-to-aws-ec2-instance.md
Point Domain to Amazon Web Services (AWS) EC2 Instance

Point Domain to Amazon Web Services (AWS) EC2 Instance

  1. Open the Amazon Route 53 console at https://console.aws.amazon.com/route53/.
  2. If you are new to Amazon Route 53, you see a welcome page; choose Get Started Now for DNS Management. Otherwise, choose Hosted Zones in the navigation pane.
  3. Choose Create Hosted Zone.
  4. For Domain Name, type your domain name.
  5. Choose Create.
  6. Click the Hosted Zone, edit record set.
  7. In the value, add ec2-54-152-134-146.compute-1.amazonaws.com.
  8. Change your DNS file to point to the IPv4 address (This would be in something like GoDaddy).
@l3th2nh
l3th2nh / Drupal-8.txt
Last active July 31, 2016 13:58 — forked from facine/__INDEX.txt
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
@l3th2nh
l3th2nh / Sublime Text 3 Build 3103 License Key - CRACK
Created July 29, 2016 08:52
Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04