Skip to content

Instantly share code, notes, and snippets.

View netfl0's full-sized avatar

Peter Kaloroumakis netfl0

  • The MITRE Corporation
  • Location Location Location
  • X @netfl0
View GitHub Profile

Keybase proof

I hereby claim:

  • I am petekalo on github.
  • I am netfl0 (https://keybase.io/netfl0) on keybase.
  • I have a public key ASDvy2NRqUBBMsDYH6F2pmCuGAVUdeh6x-9PDFIGoeixJwo

To claim this, I am signing this object:

@netfl0
netfl0 / bow.py
Created May 10, 2017 20:21 — forked from andreasvc/bow.py
Extract Bag-of-Words (BOW) models from a corpus of text files.
"""Extract several BOW models from a corpus of text files.
The models are stored in Matrix Market format which can be read
by gensim. The texts are read from .txt files in the directory
specified as TOPDIR. The output is written to the current directory."""
# NB: All strings are utf8 (not unicode).
import os
import glob
import nltk
import gensim
@netfl0
netfl0 / Safe Gigantic Django Queries
Created December 14, 2012 03:36
Django should really have this built in ...
class IterableQuerySet(object):
"""Allows iteration over a QuerySet breaking it off into smaller chunks."""
"""Take from http://justcramer.com/2009/02/09/large-sql-result-sets-in-django/"""
def __init__(self, queryset, batch=10000):
self.batch = batch
self.queryset = queryset
 
def __iter__(self):
at = 0
 
@netfl0
netfl0 / websandbox.sh
Created November 11, 2012 19:09
VirtualBox and ToR transparent proxy
----------------------------------------------
#TOR CONFIGURATION:
# transparent tor:
#TransPort 9040
#TransListenAddress 10.0.0.1
#DNSPort 53
#DNSListenAddress 10.0.0.1
-----------------------------------------------