This is a simple chat-like program using pub-sub pattern, backed by PostgreSQL's LISTEN/NOTIFY command.
publish message to foo
channel from user nickname
.
$ python pub.py foo nickname
PUBLISH to channel #foo
all: | |
open three.js.shader.html |
import cv2 | |
import time | |
import math | |
import numpy as np | |
capture = cv2.VideoCapture(0) | |
print capture.get(cv2.CAP_PROP_FPS) | |
t = 100 | |
w = 640.0 |
'''This script goes along the blog post | |
"Building powerful image classification models using very little data" | |
from blog.keras.io. | |
It uses data that can be downloaded at: | |
https://www.kaggle.com/c/dogs-vs-cats/data | |
In our setup, we: | |
- created a data/ folder | |
- created train/ and validation/ subfolders inside data/ | |
- created cats/ and dogs/ subfolders inside train/ and validation/ | |
- put the cat pictures index 0-999 in data/train/cats |
#!/bin/bash | |
# The following script installs Virtuoso on a clean Centos 6.5 system. | |
yum -y update | |
yum -y install autoconf automake libtool flex bison gperf git openssl-devel readline-devel | |
export VIRTUOSO_NAME=virtuoso-opensource | |
export VIRTUOSO_VERSION=7.1.0 | |
export VIRTUOSO_FULLNAME=$VIRTUOSO_NAME-$VIRTUOSO_VERSION | |
export VIRTUOSO_TARBALL=$VIRTUOSO_FULLNAME.tar.gz |
This is now an actual repo:
import BaseHTTPServer | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
import sys | |
import base64 | |
key = "" | |
class AuthHandler(SimpleHTTPRequestHandler): | |
''' Main class to present webpages and authentication. ''' | |
def do_HEAD(self): |
import BaseHTTPServer | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
import sys | |
import base64 | |
key = "" | |
class AuthHandler(SimpleHTTPRequestHandler): | |
''' Main class to present webpages and authentication. ''' | |
def do_HEAD(self): |
<!doctype html> | |
<html ng-app="Demo" ng-controller="DemoController"> | |
<head> | |
<meta charset="utf-8" /> | |
<title> | |
Using Controllers With ngRepeat In AngularJS | |
</title> | |
<style type="text/css"> |
""" | |
Simple demonstration of how to implement Server-sent events (SSE) in Python | |
using Bottle micro web-framework. | |
SSE require asynchronous request handling, but it's tricky with WSGI. One way | |
to achieve that is to use gevent library as shown here. | |
Usage: just start the script and open http://localhost:8080/ in your browser. | |
Based on: |