initial commit
This commit is contained in:
commit
e146caaa63
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/bash
|
||||
while read -r URL;
|
||||
do
|
||||
openssl s_client -brief -connect $URL:443 < /dev/null;
|
||||
done < ./https_urls_freepoteries
|
|
@ -0,0 +1 @@
|
|||
rsync -vai --delete-before --read-batch=/home/emixam/cloud_batch-check ${1:-/mnt/cloud/}
|
|
@ -0,0 +1 @@
|
|||
rsync -vai --delete-before --read-batch=/home/emixam/cloud_batch ${1:-/mnt/cloud/}
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
LON="8° 02' 41.9\"W"
|
||||
LAT="39° 57' 00.0\"N"
|
||||
|
||||
deg_to_dec()
|
||||
{
|
||||
deg=$(echo "$@"|awk -F\° '{ print $1 }')
|
||||
ARG=$(echo "$@"|awk -F\° '{ print $2 }')
|
||||
min=$(echo "$ARG"|awk -F\' '{ print $1 }')
|
||||
ARG=$(echo "$ARG"|awk -F\' '{ print $2 }')
|
||||
sec=$(echo "$ARG"|awk -F\" '{ print $1 }')
|
||||
|
||||
operation="scale=10; ( $deg + $min / 60 + $sec / 3600 )"
|
||||
|
||||
echo $ARG|grep -ioE "[ws]$" >/dev/null && operation="$operation * -1"
|
||||
bc <<< "$operation"
|
||||
}
|
||||
|
||||
echo "` deg_to_dec $LAT `:` deg_to_dec $LON `"
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
REC=0
|
||||
if [[ "$1" == "-r" ]];
|
||||
then
|
||||
shift;
|
||||
[[ ! -d "$1" ]] \
|
||||
&& echo "Recursive mode argument must be a directory" \
|
||||
&& exit -1
|
||||
|
||||
find "$1" -type f -exec $0 {} \;
|
||||
else
|
||||
IN="$1";
|
||||
[[ ! -f "$IN" ]] && echo "$IN is not a file. Skipping." && exit -1;
|
||||
OUT=${2:-$(echo "$1"|sed 's/\.[^\.]*$/\.mp3/')}
|
||||
[[ -e "$OUT" ]] && echo "$OUT already exists. Skipping." && exit -1;
|
||||
echo "$IN -> $OUT";
|
||||
ffmpeg -i "$IN" -vn -ar 44100 -ac 2 -ab 192k -f mp3 "$OUT" > /dev/null 2>&1;
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
# first argument : where files may be missing
|
||||
# second argument : where files may be
|
||||
|
||||
while read f;
|
||||
do
|
||||
test -z "$(find "$2" -not -iregex ".*$1.*" -name $(basename "$f"))" && echo "Missing $f in $2";
|
||||
done < <(find "$1" -type f);
|
|
@ -0,0 +1 @@
|
|||
curl 'https://www.ombord.info/hotspot/hotspot.cgi?method=login&url=https://flixbusmedia-emea.on.icomera.com/en/landing_page.html&onerror=https://flixbusmedia-emea.on.icomera.com/en/' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache'
|
|
@ -0,0 +1,107 @@
|
|||
#!/usr/bin/env perl
|
||||
use Mail::IMAPClient;
|
||||
use IO::File;
|
||||
use Data::Dumper;
|
||||
|
||||
my $cfg = do ($ENV{'HOME'}."/.config/mailbox_watcher.pl") or die "Can't read configuration file";
|
||||
my $cache_dir = $cfg->{cache_dir};
|
||||
my $log_file = IO::File->new(">>".$cache_dir."/mailbox_watcher.log") or die "Can't open log file $!";
|
||||
my $date = `date "+%Y-%m-%d %H:%M:%S"`;
|
||||
chomp $date;
|
||||
|
||||
select $log_file;
|
||||
printf "[%s] Mailbox watcher started\n", $date;
|
||||
|
||||
if ($cfg->{debug} == 1) {
|
||||
$cfg->{server}{Debug} = 1;
|
||||
$cfg->{server}{Debug_fh} = IO::File->new(
|
||||
">".$cache_dir."/imap.log")
|
||||
or die "Can't open imap log: $!\n";
|
||||
}
|
||||
|
||||
# chomp the pass as it's given from an external script -> should do it directly
|
||||
my $pass = $cfg->{server}->{Password};
|
||||
chomp $pass;
|
||||
$cfg->{server}->{Password} = $pass;
|
||||
|
||||
my $server = $cfg->{server};
|
||||
|
||||
if ($cfg->{debug} == 1) {
|
||||
print Data::Dumper->Dump([$server]);
|
||||
}
|
||||
|
||||
my $imap = Mail::IMAPClient->new(%$server)
|
||||
or die ("Can't create imap object");
|
||||
|
||||
$imap->connect or die "No connection!";
|
||||
$date = `date "+%Y-%m-%d %H:%M:%S"`;
|
||||
chomp $date;
|
||||
printf "[%s] Connected to IMAP server\n", $date;
|
||||
|
||||
my $fh = IO::File->new(">".$cache_dir."/imap_count");
|
||||
select $fh;
|
||||
foreach $box (@{$cfg->{boxes}}) {
|
||||
my $r_count = 0;
|
||||
defined($r_count = $imap->recent_count($box))
|
||||
or die "Could not count ".$box." recent: $@\n";
|
||||
|
||||
if ($r_count > 0) {
|
||||
$imap->select($box);
|
||||
#$imap->unset_flag("\Recent", @{$imap->recent});
|
||||
}
|
||||
|
||||
my $u_count = 0;
|
||||
defined($u_count = $imap->unseen_count($box))
|
||||
or die "Could not count ".$box." unseen: $@\n";
|
||||
|
||||
printf "%s\t%d/%d\n", ($box, $r_count, $u_count);
|
||||
}
|
||||
undef $fh;
|
||||
|
||||
select $log_file;
|
||||
print "OK";
|
||||
if ($cfg->{sms_send} == 1) {
|
||||
my $fh = IO::File->new("<".$cache_dir."/imap_count")
|
||||
or die "Can't open imap count file";
|
||||
my $sms = "";
|
||||
|
||||
my $date = `date "+%Y-%m-%d %H:%M:%S"`;
|
||||
chomp $date;
|
||||
printf "[%s] Building the SMS to send\n", $date;
|
||||
|
||||
while (readline($fh)) {
|
||||
if (not /\t0\//) {
|
||||
s/\t/ /g;
|
||||
s/ /:/g;
|
||||
s/\n/\\n/g;
|
||||
$sms .= $_;
|
||||
print $sms;
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
my $date = `date "+%Y-%m-%d %H:%M:%S"`;
|
||||
chomp $date;
|
||||
chomp $sms;
|
||||
if (length $sms > 0) {
|
||||
#printf "[%s] SMS to send : %s\n", ($date, $sms);
|
||||
printf "[%s] Sending SMS to number : %s\n", ($date, $cfg->{sms_number});
|
||||
my $tmp = `mktemp`;
|
||||
my $tmp_fh = IO::File->new(">".$tmp) or die "Can't open temporary file";
|
||||
|
||||
# write sms into tmp file
|
||||
select $tmp_fh;
|
||||
print $sms;
|
||||
|
||||
select $log_file;
|
||||
my $sys_call = $cfg->{sms_sender}.' '.$cfg->{sms_number}.' '.$tmp;
|
||||
!system $sys_call;
|
||||
!system "/usr/bin/rm $tmp";
|
||||
}
|
||||
else {
|
||||
printf "[%s] No new message\n", ($date, $sms);
|
||||
printf "%s, %d", ($sms, length $sms);
|
||||
}
|
||||
}
|
||||
exit;
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/bash
|
||||
#MHSSH (Multi Host SSH) : send a command on multiple hosts
|
||||
#Copyright (C) 2016 Weber Yann
|
||||
#
|
||||
#This program is free software; you can redistribute it and/or modify
|
||||
#it under the terms of the GNU General Public License as published by
|
||||
#the Free Software Foundation; either version 3 of the License, or
|
||||
#any later version.
|
||||
#
|
||||
#This program is distributed in the hope that it will be useful,
|
||||
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
#GNU General Public License for more details.
|
||||
#
|
||||
#You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Host list path (file should contains hosts seperated by $IFS )
|
||||
hosts="$HOME/.config/mhssh.hosts"
|
||||
|
||||
red=$(tput setaf 1)
|
||||
grn=$(tput setaf 2)
|
||||
raz=$(tput sgr0)
|
||||
|
||||
usage() {
|
||||
echo "Run a single command on multiple hosts"
|
||||
echo "Usage : $0 [-h|--help] [-n|--no-color] CMD ..."
|
||||
echo -e "\n\t-h --help\tprint this help\n\t-n --no-color\tdisable colors\n\n"
|
||||
echo "Host list configured to be found in '$hosts'"
|
||||
}
|
||||
|
||||
nocmd() {
|
||||
echo -e "at least one command expected...\n"
|
||||
usage
|
||||
exit 3
|
||||
}
|
||||
|
||||
# arg "parsing"
|
||||
[ $# -eq 0 ] && nocmd
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
-n|--no-color)
|
||||
[ $# -eq 1 ] && nocmd
|
||||
shift
|
||||
red='[ERR] '
|
||||
grn=''
|
||||
raz=''
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! -f "$hosts" ]
|
||||
then
|
||||
echo -e "File '$hosts' not found" >&2
|
||||
echo ""
|
||||
usage
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
for host in $(cat $hosts)
|
||||
do
|
||||
echo -e "\n$grn=====================\n$grn$host\n$grn=====================$raz\n"
|
||||
stdout=$(echo -ne "$grn$(printf "%20s" "$host") : $raz")
|
||||
stderr=$(echo -ne "$red$(printf "%20s" "$host") : $raz")
|
||||
{
|
||||
ssh $host "$@;exit" 2>&3 | sed -e "s/^/$stdout/" 1>&2
|
||||
} 3>&1 | sed -e "s/^/$stderr/"
|
||||
done
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/bash
|
||||
red=$(tput setaf 1)
|
||||
grn=$(tput setaf 2)
|
||||
raz=$(tput sgr0)
|
||||
|
||||
usage() {
|
||||
echo "Run a single command on multiple lxc containers"
|
||||
echo "Usage : $0 [-h|--help] [-n|--no-color] [-o|--os OS] CMD ..."
|
||||
echo -e "\n\t-h --help\tprint this help\n\t-n --no-color\tdisable colors\n\n"
|
||||
echo "Host list configured to be found in '$hosts'"
|
||||
}
|
||||
|
||||
nocmd() {
|
||||
echo -e "at least one command expected...\n"
|
||||
usage
|
||||
exit 3
|
||||
}
|
||||
|
||||
# arg "parsing"
|
||||
[ $# -eq 0 ] && nocmd
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
-n|--no-color)
|
||||
[ $# -eq 1 ] && nocmd
|
||||
shift
|
||||
red='[ERR] '
|
||||
grn=''
|
||||
raz=''
|
||||
;;
|
||||
-o|--os)
|
||||
if [[ "$#" -gt 0 ]];
|
||||
then
|
||||
shift;
|
||||
OS=$1;
|
||||
hosts="$HOME/.config/mhssh_lxc.$OS.hosts";
|
||||
shift;
|
||||
fi;
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z $hosts ];
|
||||
then
|
||||
hosts="$HOME/.config/mhssh_lxc.hosts";
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$hosts" ]
|
||||
then
|
||||
echo -e "File '$hosts' not found" >&2
|
||||
echo ""
|
||||
usage
|
||||
exit 2
|
||||
fi
|
||||
|
||||
while read -r host;
|
||||
do
|
||||
echo -e "\n$grn=====================\n$grn$host\n$grn=====================$raz\n"
|
||||
stdout=$(echo -ne "$grn$(printf "%20s" "$host") : $raz")
|
||||
stderr=$(echo -ne "$red$(printf "%20s" "$host") : $raz")
|
||||
{
|
||||
lxc-attach -n "$host" -- "$@" 2>&3 | sed -e "s/^/$stdout/" 1>&2
|
||||
} 3>&1 | sed -e "s/^/$stderr/"
|
||||
|
||||
done <<< $(cat $hosts)
|
||||
|
|
@ -0,0 +1 @@
|
|||
mount -t hfsplus -o force,rw /dev/sdb4 /mnt/usb/
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
lame -V9 -h "$1" "$(echo "$1"|sed 's/\.mp3$/_0&/')"
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
shopt -s nullglob globstar
|
||||
|
||||
typeit=0
|
||||
if [[ $1 == "--type" ]]; then
|
||||
typeit=1
|
||||
shift
|
||||
fi
|
||||
|
||||
prefix=${PASSWORD_STORE_DIR-~/.password-store}
|
||||
password_files=( "$prefix"/**/*.gpg )
|
||||
password_files=( "${password_files[@]#"$prefix"/}" )
|
||||
password_files=( "${password_files[@]%.gpg}" )
|
||||
|
||||
password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
|
||||
|
||||
[[ -n $password ]] || exit
|
||||
|
||||
if [[ $typeit -eq 0 ]]; then
|
||||
pass show -c "$password" 2>/dev/null
|
||||
else
|
||||
pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } |
|
||||
xdotool type --clearmodifiers --file -
|
||||
fi
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
find $1 -type f | while read FILE;
|
||||
do
|
||||
newfile="$(echo ${FILE} |sed -E 's/-[^\.]{11}\././')" ;
|
||||
mv "${FILE}" "${newfile}" ;
|
||||
done;
|
|
@ -0,0 +1 @@
|
|||
rsync -a --delete-before --read-batch=rsync_batch ${1:-test2/}
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
num=${1:-"+33614495846"}
|
||||
msg="${2}"
|
||||
tim=$(date "+%Y,%m,%d,%H,%M,%S")
|
||||
nonce=$(curl -s 'http://192.168.0.1/cgi-bin/qcmap_auth' \
|
||||
--data '{"module":"authenticator","action":0}'|jq '.nonce'|tr -d '\"')
|
||||
digest=$(printf 'admin:admin:%s' $nonce|md5sum|cut -d' ' -f1)
|
||||
json=$(printf '{"module":"authenticator","action":1,"digest":"%s"}' $digest);
|
||||
token=$(curl -s 'http://192.168.0.1/cgi-bin/qcmap_auth' \
|
||||
--data "${json}"|jq '.token'|tr -d '"')
|
||||
|
||||
num=${1:-"+33614495846"}
|
||||
msg="${2:-"Hello, World!"}"
|
||||
tim=$(date "+%Y,%m,%d,%H,%M,%S")
|
||||
tmp=$(mktemp)
|
||||
cat << EOF > $tmp
|
||||
{"token":"${token}", \
|
||||
"module":"message", \
|
||||
"action":3, \
|
||||
"sendMessage":{"to":"${num}", \
|
||||
"textContent":"$(cat ${msg})", \
|
||||
"sendTime":"${tim}"}}
|
||||
EOF
|
||||
|
||||
curl -qs 'http://192.168.0.1/cgi-bin/qcmap_web_cgi' \
|
||||
-H "Cookie: tpweb_token=${token}" \
|
||||
--data @$tmp && echo "Trying to send message"
|
||||
RES=-1
|
||||
read json << EOF
|
||||
{"token":"${token}","module":"message","action":7}
|
||||
EOF
|
||||
|
||||
while [ "$RES" -lt 0 ];
|
||||
do
|
||||
RES=$(curl -s 'http://192.168.0.1/cgi-bin/qcmap_web_cgi' \
|
||||
-H "Cookie: tpweb_token=${token}" \
|
||||
--data "$json" \
|
||||
| jq '.result')
|
||||
sleep 2;
|
||||
done;
|
||||
rm $tmp;
|
||||
exit 0;
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
get_stats()
|
||||
{
|
||||
echo -n $(curl -s 'http://192.168.0.1/cgi-bin/qcmap_web_cgi' --data '{"module":"status","action":0}')
|
||||
}
|
||||
|
||||
in_mb()
|
||||
{
|
||||
echo $(echo "scale=2; $1/1024/1024" | bc);
|
||||
}
|
||||
|
||||
stats=$(get_stats)
|
||||
total=$(echo "$stats"|jq '.wan.totalStatistics'|sed 's/"//g')
|
||||
daily=$(echo "$stats"|jq '.wan.dailyStatistics'|sed 's/"//g')
|
||||
|
||||
#echo "Total : $total";
|
||||
total=$(in_mb "$total")
|
||||
#echo "Total (MB) : $total";
|
||||
#echo "Daily : $daily";
|
||||
daily=$(in_mb "$daily")
|
||||
echo "Daily (MB) : $daily";
|
||||
|
||||
days_left=$(echo 21 - `date +%d`|bc)
|
||||
if [[ ${days_left} -eq 0 ]];
|
||||
then
|
||||
days_left=21
|
||||
elif [[ ${days_left} -lt 0 ]];
|
||||
then
|
||||
mdays=$(date --date="1 day ago 1 $(date --date="next month" "+%b")" "+%d")
|
||||
days_left=$(echo 21 + \("$mdays" - $(date +%d)\)|bc)
|
||||
fi
|
||||
#echo "Days left : $days_left";
|
||||
max_daily=$(echo "scale=2; (6144 - $total) / $days_left"|bc)
|
||||
echo "Max daily : $max_daily";
|
||||
today_rest=$(echo "$max_daily - $daily"|bc)
|
||||
echo $today_rest;
|
|
@ -0,0 +1 @@
|
|||
pip install --user --upgrade youtube-dl mps-youtube
|
Loading…
Reference in New Issue