dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 97a1b9fe8a7677c18e77c62fff0421e022406ddd
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Thu, 17 Nov 2016 22:29:37 +0100

Initial commit

Diffstat:
A.gitignore | 2++
AREADME.md | 1+
Acs_record_tasks.rb | 22++++++++++++++++++++++
Adate_formatter.rb | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adoc2tex | 2++
Aepub-convert | 1+
Aexecutable | 42++++++++++++++++++++++++++++++++++++++++++
Agfx2gfx | 0
AicalBuddy | 0
Amp3tagger.jar | 0
Apercerr.rb | 21+++++++++++++++++++++
Apopa-gone-savage.rb | 19+++++++++++++++++++
Astrip-html-tags | 4++++
Atag | 31+++++++++++++++++++++++++++++++
Awattpad-scrape | 15+++++++++++++++
15 files changed, 226 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,2 @@ +batteryCheck.scpt +.DS_Store diff --git a/README.md b/README.md @@ -0,0 +1 @@ +.bin diff --git a/cs_record_tasks.rb b/cs_record_tasks.rb @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby +## CHANGE THIS TO THE FOLDER WHERE YOU WANT TO STORE YOUR FILE ## +filepath="/Users/alex/Desktop/ /Computer Science/IA/" + +## DO NOT MODIFY UNDER THIS COMMENT +require 'date' +print "Do you have a date? (y/n) " +if (gets.chomp=="y") + print "Enter the date (y-m-d): " + date=gets.chomp +else + date=Date.today.to_s +end + +print "Enter your task: " +task=gets.chomp + +finalpath="#{filepath}record_of_tasks.csv" +File.open(finalpath, 'a') { |file| + file.puts("#{date},#{task}") +}+ \ No newline at end of file diff --git a/date_formatter.rb b/date_formatter.rb @@ -0,0 +1,66 @@ +#!/usr/bin/ruby +# make this into a library +def verbal_date_to_numeric verbal + arr = verbal.split(/[\s,]/) + month=case arr[0] +when "January" + 1 +when "February" + 2 +when "March" + 3 +when "April" + 4 +when "May" + 5 +when "June" + 6 +when "July" + 7 +when "August" + 8 +when "September" + 9 +when "October" + 10 +when "November" + 11 +when "December" + 12 +end + +arr[0]=month + + # 11, "17","2016" + + arr.map { |e| e.to_i unless e.is_a? Integer } + + # 11, 17, 2016 + # + arr[0], arr[1], = arr[1], arr[0] + + # 17, 11, 2016 + + arr.delete_at(2) + return arr.join("-") +end + +filename=ARGV[0] +lines=File.readlines("#{filename}") +newlines = [] + +lines.each do |text| + replace=text.gsub(/(^.+)[A|P]M/,'\1') + replace=replace.gsub(/(\d{4})\sat\s\d{2}:\d{2},(.*$)/,'\1,\2') + arr = replace.scan(/\w+\s\d{1,2},\s\d{4}/) + ar2 = arr.map { |e| verbal_date_to_numeric(e) } + + arr.each_with_index {|e,i| replace = replace.gsub(e,ar2[i])} + newlines << replace +end + +File.open("#{filename}", "w") do |io| + newlines.each do |line| + io.puts "#{line.chomp},Assets:Current Assets:Lunch Card Account" + end +end diff --git a/doc2tex b/doc2tex @@ -0,0 +1 @@ +/Users/alex/Documents/Github/docx2tex/d2t+ \ No newline at end of file diff --git a/epub-convert b/epub-convert @@ -0,0 +1 @@ +/Applications/Calibre.app/Contents/MacOS/ebook-convert "$1" "${1%.}.epub" diff --git a/executable b/executable @@ -0,0 +1,41 @@ +# CREATED BY ALEX BALGAVY OF INSIGHTDEV +# COPYRIGHT (C)2013 ALEX BALGAVY +# FREE TO USE OR SHARE + +#!/bin/bash +# Sets the parameters equal to variables +FILENAME="${1}" + +# Sets the exit error +NO_FILE="Exit error 85: No file found." + +# Starts the parameter case +# Checks if $FILENAME exists +if [ ! -e "$FILENAME" ]; then + echo "There is no file called $FILENAME" + echo "Please check spelling" + exit +else + echo "Congratulations found $FILENAME. " + + # Does some stuff to make it look cool + ls -lah $FILENAME + read -p "Process $FILENAME? Y or N:" PROCEED + case $PROCEED in + Y* | y*) + chmod +x $FILENAME + echo "Successfully changed to executable." + read -p "Do you want to run $FILENAME? Y or N:" RUN_OR_NOT + case $RUN_OR_NOT in + Y* | y*) + ./$FILENAME + ;; + *) + echo "File not run. You can manually run by doing ./$FILENAME" + ;; + *) + echo "File not processed." + ;; + esac +esac +fi+ \ No newline at end of file diff --git a/gfx2gfx b/gfx2gfx Binary files differ. diff --git a/icalBuddy b/icalBuddy Binary files differ. diff --git a/mp3tagger.jar b/mp3tagger.jar Binary files differ. diff --git a/percerr.rb b/percerr.rb @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby + +puts "Welcome to the Percent Error Calculator." +print "What is your estimated value? >> " +estimated=gets.chomp.to_f +print "What is your measured value? >> " +measured=gets.chomp.to_f + +if estimated>measured + err=estimated-measured +else + err=(estimated-measured)*-1 +end + +puts "Your error is " + err.to_s + "." + +percerr=(err/measured)*100 + +puts "Your percent error is " + percerr.to_s + "%." +puts "Rounded, this is " + percerr.round().to_s + "%."+ \ No newline at end of file diff --git a/popa-gone-savage.rb b/popa-gone-savage.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby +## CHANGE THIS TO THE FOLDER WHERE YOU WANT TO STORE YOUR FILE ## +filepath="/Users/alex/Desktop/ /Computer Science/" + +## DO NOT MODIFY UNDER THIS COMMENT +require 'date' +date=Date.today.to_s + +print "Who did he roast now: " +roastee=gets.chomp +print "Enter roast: " +roast=gets.chomp + +finalpath="#{filepath}popa-savage-quotes.csv" +File.open(finalpath, 'a') { |file| + file.puts('#{date},#{roastee},"#{roast}"') +} +puts "Roasted."+ \ No newline at end of file diff --git a/strip-html-tags b/strip-html-tags @@ -0,0 +1,4 @@ +#!/usr/local/bin/ruby +text = File.read("text.txt") +newtext = text.gsub(/<\/?[^>]+(>|$)/, "") +File.open("text.txt","w") { |file| file.puts newtext} diff --git a/tag b/tag @@ -0,0 +1,30 @@ +#!/bin/bash +clear +cd ~ +echo Welcome to MP3 Tagger! +if [ $# -eq 0 ]; then + echo 'Sorry, you have not specified a file. Please specify a file while invoking the command, such as "tag filename.mp3"' + echo "Do you want to list all of the files available? (y/n) " + read ANSWER + if [ $ANSWER == "y" ]; then + ls ~/Music/iTunes/iTunes\ Music/ + else + exit 0 + fi +else + echo The file that will be tagged is $1 + java -jar ~/.bin/mp3tagger.jar Music/iTunes/iTunes\ Music/$1 + cd Music/iTunes/iTunes\ Music/ + echo The file $1 was tagged successfully. + cp *.mp3.tag ~/Desktop/ + rm *.mp3.tag + echo "The file with the information about the tag was moved to your Desktop. Would you like to display the information it contains? (y/n)" + read INFODISPLAY + if [ $INFODISPLAY == "y" ]; then + clear + cd ~/Desktop + cat $1.tag + else + echo Okay, the .tag file was saved. Now exiting. + fi +fi+ \ No newline at end of file diff --git a/wattpad-scrape b/wattpad-scrape @@ -0,0 +1,15 @@ +#!/bin/bash +current_directory=`pwd` +if [ $# -eq 0 ]; + then + echo "Pass the URL as an argument." + exit 0 +fi +cd ~/.bin/wattpad-ebook-scraper/ +python3 scrape.py $1 +book_title=`ls | grep *.epub` +mv $book_title $current_directory/ +folder_title=`echo $book_title | sed s/\.epub//g` +rm -r $folder_title +cd $current_directory +echo "Book $book_title extracted!"