Skip to content

Instantly share code, notes, and snippets.

View Bernardoow's full-sized avatar

Bernardo Gomes Bernardoow

  • Belo Horizonte - Brazil
View GitHub Profile
@felipou
felipou / decrypt_dbeaver.py
Last active March 18, 2024 18:46
DBeaver password decryption script - for newer versions of DBeaver
# https://stackoverflow.com/questions/39928401/recover-db-password-stored-in-my-dbeaver-connection
# requires pycryptodome lib (pip install pycryptodome)
import sys
import base64
import os
import json
from Crypto.Cipher import AES
@miguelgarcia
miguelgarcia / factories.py
Last active January 29, 2024 13:08
Python: factoryboy + sqlalchemy. SubFactory and RelatedFactory example
# factories
class CategoryFactory(factory.alchemy.SQLAlchemyModelFactory):
class Meta:
model = models.Category
sqlalchemy_session = db.session
sqlalchemy_session_persistence = 'commit'
name = factory.Sequence(lambda n: u'Category %d' % n)
class CompanyFactory(factory.alchemy.SQLAlchemyModelFactory):
@miguelgrinberg
miguelgrinberg / sqlalchemy-challenge.py
Last active October 18, 2022 06:51
A little SQLAlchemy challenge. See blog post at https://blog.miguelgrinberg.com/post/nested-queries-with-sqlalchemy-orm for details!
#!/usr/bin/env python
# Before you run this script make sure Flask-SQLAlchemy is installed in
# your virtual environment
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' # in-memory
@bcnzer
bcnzer / postman-pre-request.js
Last active April 30, 2024 21:20
Postman pre-request script to automatically get a bearer token from Auth0 and save it for reuse
const echoPostRequest = {
url: 'https://<my url>.auth0.com/oauth/token',
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
client_id:'<your client ID>',
client_secret:'<your client secret>',
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active May 3, 2024 22:39
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@mihow
mihow / load_dotenv.sh
Last active May 4, 2024 12:32
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
@qodot
qodot / pytest_flask_fixtures.py
Created November 10, 2016 01:30
Pytest Fixtures (Flask, SQLAlchemy, Alembic)
import sys
import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from alembic.command import upgrade as alembic_upgrade
from alembic.config import Config as AlembicConfig
from wsgi import create_app
from config import config
port module Spelling exposing (..)
import Html exposing (..)
import Html.App as App
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import String
main =
@wesleybliss
wesleybliss / docker-compose-node-mongo.yml
Created September 9, 2016 21:37
Docker Compose with example App & Mongo
version: '2'
services:
myapp:
build: .
container_name: "myapp"
image: debian/latest
environment:
- NODE_ENV=development
- FOO=bar
volumes:
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE