Skip to content

Instantly share code, notes, and snippets.

View ahmohamed's full-sized avatar

Ahmed Mohamed ahmohamed

View GitHub Profile
import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
class WebSocketsHandler(SocketServer.StreamRequestHandler):
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
import numpy as np
from math import pi, log
import pylab
from scipy import fft, ifft
from scipy.optimize import curve_fit
i = 10000
x = np.linspace(0, 3.5 * pi, i)
y = (0.3*np.sin(x) + np.sin(1.3 * x) + 0.9 * np.sin(4.2 * x) + 0.06 *
np.random.randn(i))
@ahmohamed
ahmohamed / index.html
Last active August 29, 2015 14:15 — forked from mbostock/.block
Collision detection in transition
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<style>
path {
fill: none;
stroke: #000;
stroke-width: 3px;
}
@ahmohamed
ahmohamed / README.md
Last active January 31, 2023 23:26 — forked from mbostock/.block
D3.js: Panning with mouse wheel

This example demonstrate how to remap D3 events. MouseWheel event is used to pan the chart in x and y directions. This example was created as an answer to this SO question (Refer to it for detailed explanation).