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
#!/usr/bin/env bash | |
#The MIT License (MIT) | |
#Copyright (c) 2014 Oak Ridge National Laboratory | |
#Permission is hereby granted, free of charge, to any person obtaining a copy | |
#of this software and associated documentation files (the "Software"), to deal | |
#in the Software without restriction, including without limitation the rights | |
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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
conda clean -t # will remove the old tarballs | |
conda clean -p # will remove outdated packages | |
# conda clean -tp # if you want both |
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
# Load library ------------------------------------------------------------ | |
library(dplyr) | |
# Basic functions to explore NA in Dataframe -------------------------------------------------------------- | |
# Identify all missing variables per columns | |
countNaCol <- function(data) { | |
result <- vapply(data,function(x) sum(is.na(x)),integer(1)) | |
result <- data.frame(Nbna = result, napercentage = round(result/nrow(data),3)) |
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
# Quick look to the size of mysql of all databases | |
ls -lah /var/lib/mysql |
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
SELECT table_schema AS "database_name", SUM(data_length + index_length) / 1024 / 1024 AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema; |
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
scp -c blowfish -C username@ip:path_remote path_client |
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
df_season=df.groupby(df.date.dt.month)[colname].sum() | |
df_season=df.groupby(df.date.dt.dayofweek)[colname].sum() | |
df_season=df.groupby(df.date.dt.quarter)[colname].sum() | |
#etc |
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
#History of logins | |
cat /var/log/auth.log |
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
# scan all ports | |
nmap -sP 192.168.1.0/24 | |
# scan all ports and try to detect mac address | |
sudo nmap -sP 192.168.1.0/24 | |
# scan list of posts | |
nmap -O 192.168.1.1-42 # scan from 1 to 42 | |
# Os detection |
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
docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm |