This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jgroups.JChannel; | |
import org.jgroups.Message; | |
import org.jgroups.ReceiverAdapter; | |
import org.jgroups.View; | |
import org.jgroups.util.Util; | |
public class Chat { | |
public static void main(String[] args) throws Exception { | |
JChannel ch = new JChannel("tcp.xml"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import * | |
env.hosts = ['host.name.com'] | |
env.user = 'user' | |
env.key_filename = '/path/to/keyfile.pem' | |
def local_uname(): | |
local('uname -a') | |
def remote_uname(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
log 127.0.0.1 local0 | |
log 127.0.0.1 local1 notice | |
#log loghost local0 info | |
maxconn 4096 | |
#chroot /usr/share/haproxy | |
user haproxy | |
group haproxy | |
daemon | |
#debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matrix = [(0,1,2), (0,1,2), (0,1,2)] | |
transposed = zip(*matrix) # pythonic transpose! | |
print transposed | |
# >>> [(0, 0, 0), (1, 1, 1), (2, 2, 2)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
from functools import update_wrapper, wraps | |
except ImportError: | |
from django.utils.functional import update_wrapper, wraps # Python 2.4 fallback. | |
from django.http import HttpResponseForbidden | |
from django.utils.decorators import available_attrs | |
def user_passes_test(test_func): | |
def decorator(view_func): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title></title> | |
<style> | |
body { | |
background: white; | |
text-align: center; | |
padding: 20px; | |
font-family: Georgia, serif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bottle import app, route | |
@route('/') | |
def index(): | |
return 'Oh Hai!' | |
application = app() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################## | |
# Sample client-side OpenVPN 2.0 config file # | |
# for connecting to multi-client server. # | |
# # | |
# This configuration can be used by multiple # | |
# clients, however each client should have # | |
# its own cert and key files. # | |
# # | |
# On Windows, you might want to rename this # | |
# file so it has a .ovpn extension # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConnectionHandler(SockJSConnection): | |
def __init__(self, *args, **kwargs): | |
super(ConnectionHandler, self).__init__(*args, **kwargs) | |
self.client = brukva.Client() | |
self.client.connect() | |
self.client.subscribe('some_channel') | |
def on_open(self, info): | |
self.client.listen(self.on_chan_message) |
OlderNewer