Advertisement
Guest User

Untitled

a guest
Apr 7th, 2018
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.00 KB | None | 0 0
  1. [code]
  2. # Usage: push 'title' 'body'
  3. # Send pushbullet notification to device. Useful after long commands/jobs finish
  4. curl --header 'Access-Token: {{access_token}}' \
  5.      --header 'Content-Type: application/json' \
  6.      https://api.pushbullet.com/v2/pushes \
  7.      -X POST -d '{"type": "note", "title": "'"$1"'", "body": "'"$2"'", "device_iden": "{{device_id}}"}'
  8. [/code]
  9. [code]
  10. #!/usr/bin/env bash
  11. # Usage: convertcopy img.jpg
  12. # Make copies of an image that bypass dupe image checks
  13. convert "$1" -resize 101% ~/tmp/"$1"_COPY1
  14. convert "$1" -resize 102% ~/tmp/"$1"_COPY2
  15. convert "$1" -resize 103% ~/tmp/"$1"_COPY3
  16. convert "$1" -resize 104% ~/tmp/"$1"_COPY4
  17. [/code]
  18. [code]
  19. #!/usr/bin/env bash
  20. # Usage: manytomp4 dir/*.avi
  21. for file in "$1"; do
  22.   if [ -e "$file" ]; then
  23.     ffmpeg -i "$file" -f mp4 -vcodec libx264 -preset fast -profile:v main -acodec aac "$file.mp4" -hide_banner
  24.     notify-send "$file done"
  25.   fi
  26. done
  27. notify-send "all done"
  28. [/code]
  29. [code]
  30. #!/usr/bin/env bash
  31. #Usage : tomp4 vid.avi
  32.  
  33. ffmpeg -i "$1" -f mp4 -vcodec libx264 -preset fast -profile:v main -acodec aac "$2" -hide_banner
  34. [/code]
  35. [code]
  36. #!/usr/bin/env python3
  37. # For figuring out how long until the workday is over
  38. import sys
  39. from datetime import datetime, timedelta
  40. """ Usage: timeuntil 09:00pm """
  41.  
  42.  
  43. def main():
  44.   now = datetime.now()
  45.   try:
  46.     input_time = datetime.strptime(sys.argv[1], '%I:%M%p')
  47.   except:
  48.     print('Expected argument timestamp string in the format 09:00am')
  49.     sys.exit()
  50.   input_time = datetime.combine(datetime.today(), datetime.time(input_time))
  51.   delta = input_time - now
  52.   duration = format_delta(delta)
  53.   print(duration)
  54.  
  55.  
  56. def format_delta(delta):
  57.   s = delta.seconds
  58.   hours = s // 3600
  59.   # remaining seconds
  60.   s = s - (hours * 3600)
  61.   # minutes
  62.   minutes = s // 60
  63.   # remaining seconds
  64.   seconds = s - (minutes * 60)
  65.   return f'{hours}h {minutes}m {seconds}s'
  66.  
  67.  
  68. if __name__ == '__main__':
  69.   main()
  70. else:
  71.   print('Must be run as standalone script')
  72.   sys.exit()
  73. [/code]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement