Skip to content

Instantly share code, notes, and snippets.

View marcuxyz's full-sized avatar
🏠
Working from home

Marcus Almeida marcuxyz

🏠
Working from home
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
)
@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:
@alanrrb
alanrrb / dicas_capybara.md
Last active July 21, 2021 19:29
Dicas Capybara + Rspec

Dicas Capybara + Rspec

Navegando

visit('/path')
visit(models_path)
visit(model_path(model))
visit '/path'
@cryptix
cryptix / LICENSE
Last active March 10, 2024 09:55
example of using JWT for http authentication in go
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE S
@jakejscott
jakejscott / server.go
Created February 12, 2014 07:11
oauth2 martini google
package main
import (
"github.com/codegangsta/martini"
"github.com/martini-contrib/oauth2"
"github.com/martini-contrib/sessions"
)
func main() {
m := martini.Classic()
@bgentry
bgentry / rated.go
Created October 11, 2012 23:48
Go token bucket rate limiter #golang
package main
import (
"fmt"
"time"
)
func main() {
ticker := rateLimit(4, 10)