Skip to content

Instantly share code, notes, and snippets.

View alco's full-sized avatar
🇺🇦

Oleksii Sholik alco

🇺🇦
View GitHub Profile
package main
import (
m "math"
)
const LIMIT = 100
func main() {
// They don't recomend working with raw arrays, so use a slice
@alco
alco / gist:3731366
Created September 16, 2012 07:03 — forked from james4k/gist:3730918
package main
import "fmt"
import "math"
func FastInvSqrt(x float32) float32 {
xhalf := float32(0.5) * x
i := math.Float32bits(x)
i = 0x5f3759df - i>>1
x = math.Float32frombits(i)
@alco
alco / index.html
Created April 24, 2012 08:25 — forked from saghul/index.html
Simple HTML WebSocket client for the ZeroMQ gateway
<html>
<head>
<title>ZWS Example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ></script>
<script language='javascript'>
$(document).ready(function() {
var ws = new WebSocket("ws://localhost:9999/test");
ws.onmessage = function(evt) {
$('#output').append(evt.data+'<br />');
@alco
alco / producer_multicast.py
Created April 24, 2012 08:25 — forked from saghul/producer_multicast.py
ZMQ multicast producer example
# producer
import zmq
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.setsockopt(zmq.LINGER, 0) # discard unsent messages on close
socket.connect('epgm://239.192.1.1:5000')
while True:
@alco
alco / zmq_websocket_gateway.py
Created April 24, 2012 08:25 — forked from saghul/zmq_websocket_gateway.py
A ZeroMQ - WebSocket gateway
# coding=utf8
# Copyright (C) 2011 Saúl Ibarra Corretgé <saghul@gmail.com>
#
import hashlib
import os
import re
import socket
import struct