Skip to content

Instantly share code, notes, and snippets.

View robsonpiere's full-sized avatar
📚
Learning Data Science 👨‍💻

Robson Piere robsonpiere

📚
Learning Data Science 👨‍💻
View GitHub Profile
@eduardoklosowski
eduardoklosowski / analise.ipynb
Created July 8, 2022 11:37
Comparação dos loops do asyncio e do uvloop no cPython 3.10 e PyPy 3.9-7.3.9
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JosimarCamargo
JosimarCamargo / README.md
Last active April 6, 2024 15:39
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

@willienillie
willienillie / magic_mock_cheat_sheet.py
Last active April 15, 2024 18:13
Python MagicMock Mocking Cheatsheet
# needed imports
from mock import MagicMock, call
if __name__ == "__main__":
# create magic mock
mocker = MagicMock()
# make a single call
mocker("foo")
# check if method was called
@alecos71
alecos71 / Fix-Curl-SQLite3-in-PHP-7.4-under-Windows.md
Last active December 16, 2023 02:46
How to fix errors generated by PHP 7.4 related to CURL & SQLite3 under Windows

Fix for CURL & SQLite3 under Windows on PHP 7.4

If you have just downloaded and configured PHP 7.4 and you want to use CURL and SQLite3 you could run into a serious PHP-generated error for the reason that both CURL and SQlite3 make use of an external library located in the PHP directory. First SQLite3 was integrated into PHP but from version 7.4 no longer. The errors are these:

PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite'

PHP Warning: PHP Startup: Unable to load dynamic library 'sqlite3'

PHP Warning: PHP Startup: Unable to load dynamic library 'php_curl'

@estorgio
estorgio / Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver).md
Last active July 5, 2024 10:17
Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

This guide will walk you through the steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest.

Prerequisites

This guide assumes that you are using the following setup:

You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot).

@romkatv
romkatv / install_meslo_wsl.sh
Last active July 11, 2024 13:16
Install Meslo Powerline font family on Windows
#!/bin/bash
#
# This script installs patched Meslo Powerline font family on Windows.
# The fonts are installed for the current user only. The script must be
# run from WSL.
#
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/romkatv/aa7a70fe656d8b655e3c324eb10f6a8b/raw/install_meslo_wsl.sh)"
#
# If you just want the font files, they are in
# https://github.com/romkatv/dotfiles-public/tree/master/.local/share/fonts/NerdFonts.
@cromat
cromat / wsl-redis-start.md
Last active January 8, 2024 21:32
Run redis inside WSL as background service on Windows startup

Step by step guide to run redis-server inside WSL(Windows Subsystem for Linux) on Windows

I have tried to setup redis as starting background task with wsl-autostart, Task Scheduler and with lot vbs scripts including one described here but none of them seemed to work.

In the end I have manually created a simple one that does the job. This script basically starts a hidden Ubuntu Window and starts redis-server inside it.

  1. Install WSL (this is tested with Ubuntu 18.04 version)
  2. Install redis-server inside WSL sudo apt install redis-server
  3. Add sudo permission to your user to execute service command without password
@lotusirous
lotusirous / app.py
Created January 26, 2019 12:38
Example of flask blueprint and register logging to root logger
import logging
from flask import Flask
from werkzeug.utils import find_modules, import_string
def configure_logging():
# register root logging
logging.basicConfig(level=logging.DEBUG)
logging.getLogger('werkzeug').setLevel(logging.INFO)
@marcieltorres
marcieltorres / get_address_by_cep.py
Created August 25, 2018 02:18
ViaCEP: AWS Lambda Function para buscar endereço através do CEP
import json
import urllib
import re
def lambda_handler(event, context):
if 'cep' in event and _regex(event['cep']):
return json.loads(urllib.request.urlopen(_get_url_api(event['cep'])).read())
return json.loads("{\"erro\": true, \"mensagem\": \"Formato incorreto\"}")
@dinvlad
dinvlad / pre_request.js
Last active April 11, 2024 02:57
Auto-generate Google Access and ID tokens from a Service Account key and save it in Postman
/* This script auto-generates a Google OAuth token from a Service Account key,
* and stores that token in accessToken variable in Postman.
*
* Prior to invoking it, please paste the contents of the key JSON
* into serviceAccountKey variable in a Postman environment.
*
* Then, paste the script into the "Pre-request Script" section
* of a Postman request or collection.
*
* The script will cache and reuse the token until it's within