Skip to content

Instantly share code, notes, and snippets.

View alertor's full-sized avatar

Stefan Taranu alertor

  • Bucharest, Romania
View GitHub Profile
@gavinmh
gavinmh / ner.py
Last active December 5, 2018 18:59
Named Entity Extraction with NLTK in Python
# -*- coding: utf-8 -*-
'''
'''
from nltk import sent_tokenize, word_tokenize, pos_tag, ne_chunk
def extract_entities(text):
entities = []
for sentence in sent_tokenize(text):
@SeanHayes
SeanHayes / fabfile.py
Last active September 27, 2020 20:10
Example Fabric fabfile.py. It's a hodgepodge of old scripts and probably isn't best practice (uWSGI ought to have an init script), but it should give you a practical idea of how to use Fabric. This fabfile relies heavily on custom settings from a Django project in order to be more DRY. Includes commands for setting up a fresh Ubuntu Server insta…
# -*- coding: utf-8 -*-
#Copyright (C) 2013 Seán Hayes
import my_project.settings as dj_settings
from fabric.api import local, run, sudo, env, prompt, settings, cd, parallel, execute
from fabric.contrib.files import exists
from fabric.decorators import hosts, roles, runs_once
import json
import logging
import os
#package.json
{
"name": "redis_nutcracker_agent",
"version": "0.0.1",
"description": "Redis agent for nutcracker update",
"dependencies": {
"node-sentinel": "0.0.3",
"underscore": "~1.4.4",
"async": "~0.2.5",
"nodemailer": "~0.3.42"
@zshannon
zshannon / README.md
Last active December 16, 2020 14:02
Bash script for MySQL Dumps GPG Public Key encrypted, then offloaded to S3.

mysql-backup.sh will dump all of your MySQL databases, encrypt them using a GPG public key, transfer them to a S3 bucket, then delete them.

Getting Started:

  1. Install s3cmd ($ apt-get install s3cmd)
  2. Generate a GPG key and upload it to a key server. Remember the $KEY_ID and $KEY_NAME. (Google this. It's straightforward.)
  3. Download the GPG key onto the MySQL host server. ($ gpg --keyserver subkeys.pgp.net --recv-key $KEY_ID)
  4. Create a new keyring for this key. ($ gpg --export $KEY_NAME | sudo tee /etc/backups/keyring.gpg > /dev/null)
  5. Put mysql-backup.sh somewhere, and CHMOD 755 it. (/etc/backups/mysql-backup.sh is cool.)
  6. Test it. ($ ./etc/backups/mysql-backup.sh)
  7. Check your S3 bucket for the backup file, download it and decrypt it using the private key you made in Step 2.
@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
@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 :
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:
@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
@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":{
@dol
dol / .gitignore
Last active November 29, 2016 14:20
Store mitmdump raw requests and responses instead of internal format
/tmp/