Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [code]
- # Usage: push 'title' 'body'
- # Send pushbullet notification to device. Useful after long commands/jobs finish
- curl --header 'Access-Token: {{access_token}}' \
- --header 'Content-Type: application/json' \
- https://api.pushbullet.com/v2/pushes \
- -X POST -d '{"type": "note", "title": "'"$1"'", "body": "'"$2"'", "device_iden": "{{device_id}}"}'
- [/code]
- [code]
- #!/usr/bin/env bash
- # Usage: convertcopy img.jpg
- # Make copies of an image that bypass dupe image checks
- convert "$1" -resize 101% ~/tmp/"$1"_COPY1
- convert "$1" -resize 102% ~/tmp/"$1"_COPY2
- convert "$1" -resize 103% ~/tmp/"$1"_COPY3
- convert "$1" -resize 104% ~/tmp/"$1"_COPY4
- [/code]
- [code]
- #!/usr/bin/env bash
- # Usage: manytomp4 dir/*.avi
- for file in "$1"; do
- if [ -e "$file" ]; then
- ffmpeg -i "$file" -f mp4 -vcodec libx264 -preset fast -profile:v main -acodec aac "$file.mp4" -hide_banner
- notify-send "$file done"
- fi
- done
- notify-send "all done"
- [/code]
- [code]
- #!/usr/bin/env bash
- #Usage : tomp4 vid.avi
- ffmpeg -i "$1" -f mp4 -vcodec libx264 -preset fast -profile:v main -acodec aac "$2" -hide_banner
- [/code]
- [code]
- #!/usr/bin/env python3
- # For figuring out how long until the workday is over
- import sys
- from datetime import datetime, timedelta
- """ Usage: timeuntil 09:00pm """
- def main():
- now = datetime.now()
- try:
- input_time = datetime.strptime(sys.argv[1], '%I:%M%p')
- except:
- print('Expected argument timestamp string in the format 09:00am')
- sys.exit()
- input_time = datetime.combine(datetime.today(), datetime.time(input_time))
- delta = input_time - now
- duration = format_delta(delta)
- print(duration)
- def format_delta(delta):
- s = delta.seconds
- hours = s // 3600
- # remaining seconds
- s = s - (hours * 3600)
- # minutes
- minutes = s // 60
- # remaining seconds
- seconds = s - (minutes * 60)
- return f'{hours}h {minutes}m {seconds}s'
- if __name__ == '__main__':
- main()
- else:
- print('Must be run as standalone script')
- sys.exit()
- [/code]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement