Skip to content

Instantly share code, notes, and snippets.

View nicoaudy's full-sized avatar

Nico Audy nicoaudy

View GitHub Profile
@nicoaudy
nicoaudy / README.md
Created August 6, 2024 03:28 — 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

@nicoaudy
nicoaudy / shell.nix
Created February 12, 2024 02:02 — forked from glendmaatita/shell.nix
OnXP Python Web Development
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11";
pkgs = import nixpkgs { config = { allowUnfree = true; }; overlays = []; };
git = pkgs.git.overrideAttrs (oldAttrs: rec {
version = "2.42.0";
});
podman = pkgs.podman.overrideAttrs (oldAttrs: rec {
version = "4.7.2";
@nicoaudy
nicoaudy / touchable_opacity.dart
Created March 7, 2023 07:01
TouchableOpacity react native look a like on flutter
// ignore_for_file: unnecessary_null_comparison
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';
class TouchableOpacity extends StatefulWidget {
/// Creates a widget that uses Gesture Detector internally and works in the same way
/// but fades the child when the user touches it.
///
/// By default the opacity of the child is animated to 0.2 when the user touches it,
@nicoaudy
nicoaudy / main.dart
Created July 12, 2022 07:33 — forked from levisudak/main.dart
Flutter: Custom theme data
import 'package:flutter/material.dart';
import 'theme.dart' as Theme;
void main() {
runApp(
new MaterialApp(
title: 'CompanyApp',
color: Theme.CompanyColors.blue[500],
theme: Theme.CompanyThemeData,
home: new Scaffold(
@nicoaudy
nicoaudy / laravel_horizon.md
Created May 24, 2021 02:18 — forked from ankurk91/laravel_horizon.md
Laravel Horizon, redis-server, supervisord on Ubuntu 20 server

Laravel Horizon, redis-server, supervisord on Ubuntu server

Laravel 8.x, Horizon 5.x, Redis 6.x

Parepare application

  • Install and configure Laravel Horizon as instructed in docs
  • Make sure you can access the Horizon dashboard like - http://yourapp.com/horizon
  • For now it should show status as inactive on dashbaord

Install redis-server

@nicoaudy
nicoaudy / BackUpDatabase.php
Created February 22, 2021 09:21 — forked from hungthai1401/BackUpDatabase.php
Laravel command backup, restore postgresql database
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
class BackUpDatabase extends Command
{
@nicoaudy
nicoaudy / README.md
Created February 16, 2021 06:46 — forked from mul14/README.md
Simple Laravel Search Trait

Usage

Put SearchTrait.php in app directory. Then use SearchTrait in your model, like so

use App\SearchTrait;
use Illuminate\Database\Eloquent\Model;

class Article extends Model 
{
@nicoaudy
nicoaudy / listchars.vim
Created July 14, 2020 02:23 — forked from while0pass/listchars.vim
show/hide hidden characters in Vim
" hide hidden chars
:set nolist
" show hidden characters in Vim
:set list
" settings for hidden chars
" what particular chars they are displayed with
:set lcs=tab:▒░,trail:▓,nbsp:░
" or
@nicoaudy
nicoaudy / node_nginx_ssl.md
Created April 19, 2020 04:18 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@nicoaudy
nicoaudy / authorized_keys
Created January 6, 2020 04:58
Share preference id_rsa to authorized in server. change the user and host 🚀
cat ~/.ssh/id_rsa.pub | ssh USER@HOST "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"