#Country ban with UFW#
Grab your different country ip addresses and save as Linux IPTables
http://www.ip2location.com/free/visitor-blocker
##Add country## Run the following command
| #!/usr/bin/env python | |
| # Parse disk:* from lshw -xml | |
| """ | |
| Sample Output: | |
| ATA Disk Hitachi HDS72105 /dev/sda | |
| Disk Space: 500107862016 | |
| Sector size: 512 |
| #!/usr/bin/env python3 | |
| import argparse | |
| import pprint | |
| import os | |
| import sys | |
| import datetime | |
| import signal | |
| from time import sleep | |
| from lxml import etree |
| #!/usr/bin/env python3 | |
| import requests | |
| import sys | |
| import xml.etree.ElementTree as ET | |
| import datetime | |
| # ICECAST RELATED CONSTANTS | |
| STATS_URL = "http://<URL>" | |
| ICECAST_USER = "<USER>" |
| import xml.etree.ElementTree as ET | |
| import urllib.request as MYURL | |
| # tree = ET.parse('song.xml') | |
| # rss = tree.getroot() | |
| # for element in rss.findall('.channel/song'): | |
| # print(element.attrib.get('sname')) | |
| # print(element.findtext('title')) | |
| # print(element.findtext('singer')) | |
| kmaURL = "http://www.kma.go.kr/weather/forecast/mid-term-rss3.jsp?stnId=109" |
#Country ban with UFW#
Grab your different country ip addresses and save as Linux IPTables
http://www.ip2location.com/free/visitor-blocker
##Add country## Run the following command
| #!/usr/local/bin/python | |
| import os | |
| import plivo | |
| import sys | |
| from time import strftime | |
| if not os.path.isdir(PATH): | |
| sys.exit() |
| #!/bin/bash | |
| date=`date +%Y-%m-%d` | |
| RETENTION_PERIOD="7" | |
| HEADER="Backup data" | |
| remove_oldfiles(){ | |
| echo "Removing directory $1 files older than $RETENTION_PERIOD days" | wall | |
| find $1 -type f -mtime +$2 -exec rm '{}' \; | |
| } | |
| BACKUPDIR="/disk0/svn_backup/001/" |
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| from os import listdir | |
| import json | |
| net = '/sys/class/net' | |
| stat = net + '/{}/statistics/{}x_bytes' | |
| interfaces = filter(lambda x: 'eth' in x, listdir(net)) |
| from flask import Flask, render_template | |
| app = Flask(__name__) | |
| @app.route('/') | |
| @app.route('/index') | |
| def index(chartID = 'chart_ID', chart_type = 'bar', chart_height = 350): | |
| chart = {"renderTo": chartID, "type": chart_type, "height": chart_height,} | |
| series = [{"name": 'Label1', "data": [1,2,3]}, {"name": 'Label2', "data": [4, 5, 6]}] | |
| title = {"text": 'My Title'} |