This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import requests | |
r = requests.get('https://attack.mitre.org/versions/v10/') | |
soup = BeautifulSoup(r.text) | |
tables = soup.find_all('table')[1] | |
fout = open('mitre_attack.csv', 'w') | |
for tr in tables.find_all('td'): | |
if tr.a == None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Return the prediction | |
#' @json | |
#' @post /predicts | |
function(req){ | |
predict <- list(status=0, message="success"); | |
predict | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(plumber) | |
app_dir <- Sys.getenv("ROOT_DIR","/home/apps") | |
setwd(app_dir) | |
plumbers <- plumb( | |
paste0(app_dir, "/analysis.R") | |
) | |
plumbers$run(host="127.0.0.1", port=19012) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Structure | |
# . | |
# jars | |
# dist.txt | |
# branch | |
# default | |
# [your branch] | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
import os,json,datetime | |
CMD_LIST = 'yarn application -list' | |
CMD_STATUS = 'yarn application -status {}' | |
toDict = lambda x: { x.split(":")[0].strip(): x.split(":")[1].strip() } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import calendar | |
import datetime | |
def create_date_dimension(start='2019-01-01', end='2020-12-31'): | |
df = pd.DataFrame({"Date": pd.date_range(start, end)}) | |
df["Day"] = df.Date.dt.weekday_name | |
df["Week"] = df.Date.dt.weekofyear | |
df["Quarter"] = df.Date.dt.quarter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
import time | |
import prometheus_client | |
from prometheus_client import start_http_server, Histogram, Gauge, CollectorRegistry | |
#-global variable | |
global _proxies, _solr_host, _solr_port, _prometheus_gateway_host, prometheus_gateway_port | |
_proxies = dict(http='socks5://localhost:9000', https='socks5://localhost:9000') | |
_use_proxy = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-[http] | |
#-Access.log | |
%{IPORHOST:clientip} - - \[%{HTTPDATE:timestamp}\] "(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})" %{NUMBER:response} (?:%{NUMBER:bytes}|-) %{QS:referrer} %{QS:agent} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#- source : https://pymotw.com/2/csv/ | |
import csv | |
import sys | |
f = open(sys.argv[1], 'rt') | |
fout = open(sys.argv[1] + '.dsv', 'w') | |
def clean(x): | |
return x.replace('|', '') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can safely unmount and spin-down an external hard disk from the terminal most easily by using the command-line functionality of udisks, | |
which does not require the use of sudo if your system is set up correctly. (To list your device names, enter mount in the terminal first.) | |
When you have found your external drive, use the following commands. | |
You must first unmount the partition (use sdb1 or whatever mount showed as the location): | |
udisks --unmount /dev/sdb1 | |
Then to safely remove (i.e. spindown- you will hear it click and spin-down), use only sdb, for example: | |
udisks --detach /dev/sdb |
NewerOlder