Skip to content

Instantly share code, notes, and snippets.

View maurobaraldi's full-sized avatar

Mauro Navarro Baraldi maurobaraldi

View GitHub Profile
/*
1. Download and run https://raw.githubusercontent.com/esp8266/Arduino/master/libraries/ESP8266WiFi/examples/BearSSL_CertStore/certs-from-mozilla.py
2. Make sure the `certs.ar` file is in the `data/` directory in your project.
3. Download and install ESP8266LittleFS (see https://arduino-esp8266.readthedocs.io/en/latest/filesystem.html#uploading-files-to-file-system)
4. Run Tools > ESP8266 LittleFS Data Upload
5. Upload this sketch
/***************************************************
Adafruit MQTT Library ESP8266 Example
@mafayaz
mafayaz / simpleRestfulHttpServerInPython
Created July 5, 2016 11:57
Writing Simple HTTP Server in Python (With REST and JSON)
There are many already existing powerful http servers that can be used in python e.g. gevent, twisted web server. However, they are a bit complex to use and you cannot start them in a thread other than the main thread.
Here is a sample of basic http server using "BaseHTTPRequestHandler". The example exposed two rest interfaces:
To ingest records into the web server
To retrieve already ingested records from the web server
The records are assumed to be JSON based, however, any type of records can be ingested.
[sourcecode language="python" wraplines="false" collapse="false"]
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
@rochacbruno
rochacbruno / main.py
Created April 22, 2015 15:26
Taxonomy Tree AutoVivification
from taxonomy_tree import TaxonomyTree
taxonomy = TaxonomyTree()
taxonomy.linguagens.script.python
taxonomy.linguagens.script.perl
taxonomy.linguagens.funcionais.elixir
taxonomy.linguagens.funcionais.f_sharp
taxonomy.databases.nosql.mongo
taxonomy.databases.nosql.cassandra
@Manouchehri
Manouchehri / acceptgzipped.py
Last active May 29, 2022 11:44
Allowing gzip encoding with urllib
__author__ = 'David Manouchehri'
from bs4 import BeautifulSoup
import urllib.request
import gzip
import io
url = 'http://yoururlgoesherehopefullythisisntavalidurl.com/pages.html'
headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',

Create a Basic Flask Development Environment

This tutorial walks you through setting up the tools you need to begin developing in Python and Flask. Note: I assume you are on a Unix environment (OSX, Linux, Linux VM on Windows).

What you need

  • Python 2.7.x
  • easy_install and pip
  • Git 1.7/1.8
  • virtualenv
@emergent
emergent / mechanize_with_proxy_and_basicauth.rb
Created October 30, 2012 23:47
Using mechanize with proxy and basic auth
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
agent.set_proxy('proxy.example.com', 80, 'username', 'password')
agent.add_auth('http://hoge.com','b_username','b_password')
agent.user_agent_alias = "Windows Mozilla"
res = agent.get('http://hoge.com/some/page')
puts res.body
@ptigas
ptigas / gist:2820165
Created May 28, 2012 17:21
linked list implementation in python
class Node :
def __init__( self, data ) :
self.data = data
self.next = None
self.prev = None
class LinkedList :
def __init__( self ) :
self.head = None
@webwurst
webwurst / flaskr.py
Created March 6, 2012 11:09
This is the Flaskr-Tutorial using CouchDB instead of sqlite. For the original Tutorial see http://flask.pocoo.org/docs/tutorial/.
# -*- coding: utf-8 -*-
"""
Flaskr
~~~~~~
A microblog example application written as Flask tutorial with
Flask and couchdbkit.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.