Skip to content

Instantly share code, notes, and snippets.

View dufferzafar's full-sized avatar

Shadab Zafar dufferzafar

View GitHub Profile
@dufferzafar
dufferzafar / ping.py
Created November 28, 2015 16:01 — forked from pklaus/ping.py
A pure python ping implementation using raw socket.
#!/usr/bin/env python2
"""
Other Repositories of python-ping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* https://github.com/l4m3rx/python-ping supports Python2 and Python3
* https://bitbucket.org/delroth/python-ping
@dufferzafar
dufferzafar / TileLayer.Common.js
Last active August 29, 2015 14:25 — forked from mourner/TileLayer.Common.js
Leaflet shortcuts for common tile providers
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {
@dufferzafar
dufferzafar / tfidf.py
Last active August 29, 2015 14:14 — forked from sloria/tfidf.py
import math
from text.blob import TextBlob as tb
def tf(word, blob):
return blob.words.count(word) / len(blob.words)
def n_containing(word, bloblist):
return sum(1 for blob in bloblist if word in blob)
def idf(word, bloblist):