Skip to content

Instantly share code, notes, and snippets.

View alertor's full-sized avatar

Stefan Taranu alertor

  • Bucharest, Romania
View GitHub Profile
# coding=UTF-8
from __future__ import division
import nltk
import re
import requests
# Add your freebase key here
# If you don't have one, register at https://code.google.com/apis/console
FREEBASE_KEY = ""
# coding=utf-8
"""
LICENSE http://www.apache.org/licenses/LICENSE-2.0
"""
import datetime
import sys
import time
import threading
import traceback
import SocketServer
@chrisboulton
chrisboulton / ip_blacklist.lua
Last active September 19, 2024 15:42
Redis based IP blacklist for Nginx (LUA)
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
@baojie
baojie / naivebayes.py
Created July 16, 2013 21:58
NLTK based naive bayes classifier
# Jie Bao, 2013-07-16
# [email protected]
# simple Naive Bayes classifier
import nltk
from nltk.corpus import movie_reviews
import random
import os
import json
@dol
dol / .gitignore
Last active November 29, 2016 14:20
Store mitmdump raw requests and responses instead of internal format
/tmp/
@rouli
rouli / harwriter.py
Created April 28, 2013 10:44
A script to create a HAR file out of a mitmproxy's dump file
#!/usr/bin/env python
import binascii, sys, json
import version, tnetstring, flow
from datetime import datetime
def create_har(flows):
return {
"log":{
@vgheri
vgheri / test.js
Last active December 16, 2015 11:49
var should = require('should');
var assert = require('assert');
var request = require('supertest');
var mongoose = require('mongoose');
var winston = require('winston');
var config = require('./config-debug');
describe('Routing', function() {
var url = 'http://someurl.com';
// within before() you can run all the operations that are needed to setup your tests. In this case
import sys
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_exif_data(image):
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags"""
exif_data = {}
info = image._getexif()
if info:
@securitytube
securitytube / ssid-sniffer-scapy-python.py
Created April 2, 2013 12:49
WLAN SSID Sniffer in Python using Scapy
#!/usr/bin/env python
from scapy.all import *
ap_list = []
def PacketHandler(pkt) :
if pkt.haslayer(Dot11) :
if pkt.type == 0 and pkt.subtype == 8 :
@cuppster
cuppster / flask_gridfs_images.py
Created March 12, 2013 18:24
Recipe for downloading images into a mongoDB gridfs collection, then serving the images with a Flask application. No temp files created.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SYNOPSIS
flask_gridfs_images.py --start
flask_gridfs_images.py --add <IMAGE_URL>
DESCRIPTION