Skip to content

Instantly share code, notes, and snippets.

View lysandroc's full-sized avatar
⌨️
coding

Lysandro Carioca lysandroc

⌨️
coding
View GitHub Profile
@dunossauro
dunossauro / app.py
Created May 12, 2021 12:52
Flask 2.0 async support + SQLAlchemy 1.4 async ORM
from flask import Flask, request
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
from sqlalchemy.future import select
from sqlalchemy.orm import declarative_base, sessionmaker
engine = create_async_engine('sqlite+aiosqlite:///./db.db')
async_session = sessionmaker(
engine, expire_on_commit=False, class_=AsyncSession
)
@ricardopadua
ricardopadua / docker-compose.yml
Last active July 23, 2021 18:40
Architecture Distributed Environment
version: '3.4'
services:
cache-redis:
image: 'redis:6-alpine'
container_name: cache-redis
environment:
REDIS_HOST: ${REDIS_HOST}
REDIS_DEFAULT_USER: ${REDIS_DEFAULT_USER}
REDIS_DEFAULT_PASS: ${REDIS_DEFAULT_PASS}
ports:
# Alfresco users
curl -s -u user:pass http://localhost:8080/alfresco/service/api/people | jq '.people[] .userName'
curl -s -u user:pass http://localhost:8080/alfresco/service/api/people | jq '.people[] | "\(.userName),\(.firstName),\(.lastName),\(.email)"'
# Alfresco groups
curl -s -u user:pass http://localhost:8080/alfresco/service/api/groups | jq '.data[] .shortName'
curl -s -u user:pass http://localhost:8080/alfresco/service/api/groups | jq '.data[] | "\(.shortName),\(.fullName),\(.displayName)"'
@a7madgamal
a7madgamal / dark.md
Last active July 14, 2023 04:00
Dark mode for Slack on MacOS
@duluca
duluca / npm-scripts-for-docker.md
Last active April 8, 2024 09:52
npm scripts for Docker

These are generic npm scripts that you can copy & paste into your package.json file as-is and get access to convinience scripts to manage your Docker images all in one place.

How to Use

npm i -g mrm-task-npm-docker
npx mrm npm-docker

Contribute

Here's the code repository https://github.com/expertly-simple/mrm-task-npm-docker

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 6, 2024 07:52
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@wesbos
wesbos / async-await.js
Created February 22, 2017 14:02
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@nybblr
nybblr / 1-easy.js
Last active July 13, 2022 03:40
3 examples of using Async Generators and Async Iteration in JavaScript!
// Create a Promise that resolves after ms time
var timer = function(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
};
// Repeatedly generate a number starting
// from 0 after a random amount of time
var source = async function*() {
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 6, 2024 07:22
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites