Skip to content

Instantly share code, notes, and snippets.

View prochafilho's full-sized avatar

Paulo Darocha prochafilho

View GitHub Profile
@Lawouach
Lawouach / ws4py simple chat example
Created November 28, 2013 21:00
A more elaborated chat example using ws4py. It broadcasts to all clients when a message is sent. It also sends to a single client if the message is prefixed by "@Username: ..."
# -*- coding: utf-8 -*-
import argparse
import random
import os
import cherrypy
from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
from ws4py.websocket import WebSocket
from ws4py.messaging import TextMessage
@sindresorhus
sindresorhus / post-merge
Created September 6, 2013 15:46
Git hook to install npm dependencies after a `git pull`. Run `chmod +x post-merge` and put it in `.git/hooks/`. Though could really do whatever.
#!/bin/sh
npm install
@alfredodeza
alfredodeza / run.py
Last active September 5, 2017 22:14
Serve a WSGI application + static files with CherryPy
import os
import cherrypy
from cherrypy import wsgiserver
from my_wsgi_app import wsgi
PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'public'))
class Root(object):
@rich20bb
rich20bb / PythonSimpleWebsocket
Created December 2, 2012 20:10
Simple websocket server in Python. Echos back whatever is received. Works with Chome, Firefox 16, IE 10.
import time
import struct
import socket
import hashlib
import base64
import sys
from select import select
import re
import logging
from threading import Thread
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 3, 2024 19:09
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@jessedearing
jessedearing / gist:2351836
Created April 10, 2012 14:44 — forked from twoism-dev/gist:1183437
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key