Skip to content

Instantly share code, notes, and snippets.

View cletrix's full-sized avatar

Cleyton Pedroza de Almeida cletrix

View GitHub Profile
import errno
import functools
import socket
from tornado import ioloop, iostream
class Connection(object):
def __init__(self, connection):
self.stream = iostream.IOStream(connection)
self._read()
import errno
import functools
import socket
from tornado import ioloop, iostream
class Connection(object):
def __init__(self, connection):
self.stream = iostream.IOStream(connection)
self._read()
@cletrix
cletrix / install_Haxe_Neko_hxcpp_lime _OpenFL.txt
Created November 13, 2015 11:51
Install Haxe, Neko, hxcpp, lime and OpenFL (3.2.2) on a raspberry pi 2 ( 06-08-2015 )
sudo apt-get install libgc-dev libpcre3-dev
sudo apt-get install mesa-utils build-essential git cmake libx11-dev
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev libasound2-dev
#optional but recommended
sudo apt-get install sqlite3 libsqlite3-dev
sudo apt-get install libgtk2.0-dev (installs a lot of dependencies)
sudo apt-get install libmysqlclient-dev
#end optional
@cletrix
cletrix / rest-server.py
Created January 11, 2016 11:33 — forked from miguelgrinberg/rest-server.py
The code from my article on building RESTful web services with Python and the Flask microframework. See the article here: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask.ext.httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':
@cletrix
cletrix / simple_websocket_client.html
Created February 5, 2016 00:11 — forked from geoffb/simple_websocket_client.html
Super simple websockets client/server using Python. Compatible with the draft 76 challenge/response.
<!DOCTYPE html>
<html lang="en">
<head>
<title>WebSocket Client</title>
<style>
#output {
border: solid 1px #000;
}
</style>
</head>
@cletrix
cletrix / Makefile
Created May 4, 2017 12:47 — forked from nzjrs/Makefile
Python ctypes example
all: test libtest.so testmodule
libtest.so: libtest.c
$(CC) -Wall -g -fPIC -shared -o $@ $? -lc
test: test_main.c libtest.o
$(CC) -o $@ $?
testmodule: testmodule.c
python setup.py build
@cletrix
cletrix / facebook_leads.md
Created June 14, 2017 23:18 — forked from tixastronauta/facebook_leads.md
Receiving Facebook Leads on a Webhook

Receiving Facebook Leads on a Webhook

1 - Create an App

Head over to developer.facebook.com and create an App

2 - Setup the webhook

On your server, create a facebook webhook that will handle facebook calls. Then create a "leadgen" webhook on you App: https://developers.facebook.com/docs/graph-api/webhooks/v2.5

# Install Haxe using Brew and set the haxelib path
brew install haxe
haxelib setup /usr/local/Cellar/haxe/lib
# Install lime
haxelib install lime
haxelib run lime setup
# Install lime tools
haxelib install format
@cletrix
cletrix / sketch-never-ending.md
Created January 22, 2022 18:21 — forked from Bhavdip/sketch-never-ending.md
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com

@cletrix
cletrix / HttpServer.cs
Created December 23, 2022 14:20 — forked from define-private-public/HttpServer.cs
A Simple HTTP server in C#
// Filename: HttpServer.cs
// Author: Benjamin N. Summerton <define-private-public>
// License: Unlicense (http://unlicense.org/)
using System;
using System.IO;
using System.Text;
using System.Net;
using System.Threading.Tasks;