<commit_before>#!/bin/bash

# Author: <NAME>
# Sign up at: https://www.pushbullet.com/
# Enter your api and device_id below
# Add script to cron to make sure always running

SERVER=www.google.com #SERVER TO PING
URL=https://www.pushbullet.com/api/pushes #PUSHBULLET API URL
API= #ACCOUNT API KEY
DEV= #DEVICE ID
HEADING="Houston we have a problem" #NOTE TITLE
MESSAGE="Everything is on fire and the world is ending, oh noes" #NOTE BODY
SLEEP=120 #Sleep time in seconds
LOCKFILE=/tmp/pb-ping.lock

#Create lock file
if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}`; then
        echo "already running"
        exit
fi

trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT
echo $$ > ${LOCKFILE}

# Actual script
while true
do
if ping -c 1 $SERVER > /dev/null;
    then echo "Everything is fine at $(date)"
  else
        curl -s $URL -u $API: -d device_id=$DEV -d type=note -d title="$HEADING" -d body="$MESSAGE on $(date)" -X POST
    exit 0
  fi
sleep $SLEEP
done
<commit_msg>Update pb-ping.sh<commit_after>#!/bin/bash

# Author: <NAME>
# Sign up at: https://www.pushbullet.com/
# Enter your api and device_id below
# Add script to cron to make sure always running

SERVER=www.google.com #SERVER TO PING
URL="https://api.pushbullet.com/v2/pushes" #PUSHBULLET API URL
API= #ACCOUNT API KEY

NOTETITLE="Houston we have a problem" #NOTE TITLE
NOTEBODY="Everything is on fire and the world is ending, oh noes" #NOTE BODY
SLEEP=120 #Sleep time in seconds
LOCKFILE=/tmp/pb-ping.lock

#Create lock file
if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}`; then
        echo "already running"
        exit
fi

trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT
echo $$ > ${LOCKFILE}

# Actual script
while true
do
if ping -c 1 $SERVER > /dev/null;
    then echo "Everything is fine at $(date)"
  else
          curl -u $API: -X POST $URL --header 'Content-Type: application/json' --data-binary '{
                "type": "note",
                "title":"'"$NOTETITLE"'",
                "body": "'"$NOTEBODY"'"
        }'
        
    exit 0
  fi
sleep $SLEEP
done

{'fraction_non_alphanumeric': 0.13111545988258316, 'fraction_numerical': 0.006360078277886497, 'mean_word_length': 3.0818363273453095, 'pattern_counts': {'":': 3, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 5, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7001140', 'n_tokens_mistral': 744, 'n_tokens_neox': 696, 'n_words': 258}