Skip to content

Instantly share code, notes, and snippets.

View rdgms's full-sized avatar

Rodrigo Mendes rdgms

  • Mesc.la
  • São Paulo, Brasil.
View GitHub Profile

async_api.py

import asyncio
from aiohttp import ClientSession

def magic_get(url):
    async def fetch(session):
        async with session.get(url) as response:
 return await response.text()
@rdgms
rdgms / atad.csv
Created May 3, 2016 19:52 — forked from d3noob/.block
Favorite tooltip (complex version)
date close
26-Mar-12 606.98
27-Mar-12 614.48
28-Mar-12 617.62
29-Mar-12 609.86
30-Mar-12 599.55
2-Apr-12 618.63
3-Apr-12 629.32
4-Apr-12 624.31
5-Apr-12 633.68
@rdgms
rdgms / nodejs-ubuntu-bind-port-80.md
Created March 15, 2016 14:51 — forked from vibegui/nodejs-ubuntu-bind-port-80.md
Allow Node.js to bind to privileged ports without root access on Ubuntu

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

@rdgms
rdgms / gist:c07fa1f50d802a680659
Last active August 29, 2015 14:24
How do I use ajax with flux

#Ajax with Flux

##Component UserForm

var React = require('react');
var Actions = require('../actions/ServerActions');
var UserStore = require('../stores/UserStore');

function getStoreState () {
@rdgms
rdgms / gist:c84954e9b4be495c0f3c
Created October 21, 2014 13:20
nginx + nodejs + sssl
server{
listen 443;
server_name test.com www.test.com
ssl on;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/key.pem;
location / {
proxy_pass https://localhost:8080;
proxy_redirect off;
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';