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 | |
if command -v jq >/dev/null 2>&1; then | |
echo "jq parser found"; | |
else | |
echo "this script requires the 'jq' json parser (https://stedolan.github.io/jq/)."; | |
exit 1; | |
fi | |
if [ -z "$1" ] | |
then |
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 | |
CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g') | |
THRESHOLD=90 | |
if [ "$CURRENT" -gt "$THRESHOLD" ] ; then | |
mail -s 'Disk Space Alert' [email protected] << EOF | |
Your root partition remaining free space is critically low. Used: $CURRENT% | |
EOF | |
fi |
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
wget -r -nH --cut-dirs=x ftp://xxx |
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
cat /dev/null > /var/log/lastlog && cat /dev/null > ~/.bash_history && history -c && exit |
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 | |
LOG_FILE=/tmp/curlup_log.log | |
find mydir -type f -exec curl -u xxx:psw --ftp-create-dirs -T {} ftp://xxx/{} \; 2>&1 | tee ${LOG_FILE} |
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
find mydir -type f -exec curl -u xxx:psw --ftp-create-dirs -T {} ftp://xxx/{} \; |
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 | |
# | |
# Backing up the OVH server, checking the archive and sending it through FTP | |
# | |
BACKUPHOME=/home/backups | |
FTPUSER=ftpbackupser | |
FTPPASS=S0m3Th1nGH4rD | |
FTPSERVER=ftp.server.com | |
SERVER=youservername |
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
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTP_HOST} ^OLDDOMAIN\.com$ [NC] | |
RewriteRule ^(.*)$ http://NEWDOMAIN.com [R=301,L] |
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
#include <stdbool.h> | |
bool isvalueinarray(string val, int *arr, int size){ | |
int i; | |
for (i=0; i < size; i++) { | |
if (arr[i].nome == val) | |
return true; | |
} | |
return 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
const fs = require('fs'); | |
(function() { | |
const file = '/tmp/file.txt'; | |
const unlink = function() { | |
return new Promise((resolve, reject) => { | |
fs.unlink(file, function(e) { | |
if (e) { return reject(e); } | |
return resolve(); |