Skip to content

Instantly share code, notes, and snippets.

View giuliano-macedo's full-sized avatar
🏠
Working from home

Giuliano Macedo giuliano-macedo

🏠
Working from home
  • Brazil
  • 20:27 (UTC -03:00)
View GitHub Profile
@turicas
turicas / brasil_io.py
Last active August 13, 2022 23:04
Exemplo de código para acessar dados do Brasil.IO
import csv
import gzip
import io
import json
from urllib.parse import urlencode, urljoin
from urllib.request import Request, urlopen
class BrasilIO:
@escamoteur
escamoteur / nextField.dart
Created September 13, 2019 12:22
So easy is it now to implement a next field behavior for forms, meaning that the focus is moved as soon the user tabs the next button on the keyboard
class _MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
TabController _tabController;
FocusScopeNode _node = FocusScopeNode(); /// <-----------------
@override
void initState() {
_tabController = TabController(length: 3, vsync: this);
@giuliano-macedo
giuliano-macedo / tex.py
Last active August 16, 2020 18:42
Move tex files and compiles them in a temp dir, then move pdf file to root. Works on linux and requires nodemon and latexmk
#!/usr/bin/env python3
import argparse
import os
from tempfile import mkdtemp
parser=argparse.ArgumentParser()
parser.add_argument("input",type=str)
args=parser.parse_args()
pwd=os.path.realpath(os.getcwd())
@hacknug
hacknug / tailwind.config.js
Created February 8, 2019 16:54
TailwindCSS default config
/*
Tailwind - The Utility-First CSS Framework
A project by Adam Wathan (@adamwathan), Jonathan Reinink (@reinink),
David Hemphill (@davidhemphill) and Steve Schoger (@steveschoger).
Welcome to the Tailwind config file. This is where you can customize
Tailwind specifically for your project. Don't be intimidated by the
length of this file. It's really just a big JavaScript object and
@romuald
romuald / shielded.py
Created November 2, 2018 14:00
python asyncio shield decorator
def shielded(func):
"""
Makes so an awaitable method is always shielded from cancellation
"""
@wraps(func)
async def wrapped(*args, **kwargs):
return await asyncio.shield(func(*args, **kwargs))
return wrapped
@amitripshtos
amitripshtos / exception_middleware.py
Created July 18, 2017 08:56
Exception handling middleware for aiohttp (python 3.5)
def json_error(status_code: int, exception: Exception) -> web.Response:
"""
Returns a Response from an exception.
Used for error middleware.
:param status_code:
:param exception:
:return:
"""
return web.Response(
status=status_code,
@Tithen-Firion
Tithen-Firion / openload.js
Last active November 20, 2021 15:14
Openload: extract download URL using PhantomJS
// Usage: phantomjs openload.js <video_url>
// if that doesn't work try: phantomjs --ssl-protocol=any openload.js <video_url>
var separator = ' | ';
var page = require('webpage').create(),
system = require('system'),
id, match;
if(system.args.length < 2) {
console.error('No URL provided');
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 9, 2024 19:52
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

@aruld
aruld / foreachlistset.dart
Created October 19, 2011 18:30
Dart forEach() on a List/Set
main() {
List<String> list = new List<String>();
list.add('one');
list.add('two');
list.add('twelve');
list.forEach((element) => print(element));
Set<String> set = Set.from(list);
set.forEach((element) => print(element));
}