Create a table to represent tree nodes.
CREATE TABLE `tree_node` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`data_body` text,
node_deleted
datetime DEFAULT NULL,
import pandas as pd | |
from sklearn.feature_extraction.text import CountVectorizer | |
vectorizer = CountVectorizer() | |
corpus = [ 'This is a sentence', | |
'Another sentence is here', | |
'Wait for another sentence', | |
'The sentence is coming', | |
'The sentence has come' | |
] |
--- | |
- name: install apache | |
yum: name=httpd state=present | |
- name: insert firewalld rule for httpd | |
firewalld: port={{httpd_port}}/tcp permanent=true state=enabled immediate=yes | |
- name: start and enable apache | |
service: name=httpd state=started enabled=yes |
#!/usr/bin/env python | |
import os | |
import sys | |
import shlex | |
import boto3 | |
import shutil | |
import logging | |
import urllib2 | |
import botocore |
#!/usr/bin/env python | |
import os | |
import subprocess | |
from datetime import datetime | |
# Directory where the backup will be stored -- this will be changed on production | |
directory = "/usr/local/backups/mysql_user/" | |
# Generating a script to fetch grants for all users | |
grants = "select concat('show grants for ''',user,'''@''',host,''';') from mysql.user where user <> '';" |
#!/bin/sh | |
## backup each mysql db into a different file, rather than one big file | |
## as with --all-databases. This will make restores easier. | |
## To backup a single database simply add the db name as a parameter (or multiple dbs) | |
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is | |
## Create the user and directories | |
# mkdir -p /var/backups/mysql/databases | |
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup | |
## Remember to make the script executable, and unreadable by others |
This is a hands-on way to pull down a set of MySQL dumps from Amazon S3 and restore your database with it
Sister Document - Backup MySQL to Amazon S3 - read that first
# Set our variables
export mysqlpass="ROOTPASSWORD"
#!/bin/bash | |
# Disclaimer - make backups, use at your own risk. | |
# | |
# Based on this comment: http://stackoverflow.com/a/13944924/843067 | |
# Views and stored procedures have to be done separately. | |
OLDDB="old_db_name" | |
NEWDB="new_db_name" | |
MYSQL="mysql -u root -pyour_password " |
import os | |
import sys | |
import subprocess | |
import instaLooter | |
basepath = "/Users/kovid.rathee/Desktop/instaLooter/" | |
accounts = ['rupikaur_','fursty','tropicalratchet','dylankato','asyrafacha','tomashavel','runawayueli','dreamingandwandering'] | |
for account in accounts: | |
dir = basepath + account | |
print(os.path.isdir(dir)) | |
if not os.path.exists(dir): |
PYTHON_PATH=$(which python) | |
PSQL_PATH=$(which psql) | |
MYSQL_SCRIPT='mysql2file.py' | |
MYSQL_SERVER= | |
MYSQL_PORT=3306 | |
MYSQL_DATABASE= | |
MYSQL_USER= | |
MYSQL_PASSWORD= |