commit b2a065debb20b9682d9840f850a9434f45652165
parent 21aabbb1678854ad8010133d622adc713eb33b22
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Thu, 17 May 2018 23:15:44 +0200
Removed unneeded hidden files
Diffstat:
42 files changed, 0 insertions(+), 1007 deletions(-)
diff --git a/.bin/AMSTracker b/.bin/AMSTracker
Binary files differ.
diff --git a/.bin/Desktop Changer.app/Contents/Info.plist b/.bin/Desktop Changer.app/Contents/Info.plist
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleAllowMixedLocalizations</key>
- <true/>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>applet</string>
- <key>CFBundleIconFile</key>
- <string>applet</string>
- <key>CFBundleIdentifier</key>
- <string>com.apple.ScriptEditor.id.Desktop-Changer</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>Desktop Changer</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleShortVersionString</key>
- <string>1.0</string>
- <key>CFBundleSignature</key>
- <string>aplt</string>
- <key>LSMinimumSystemVersionByArchitecture</key>
- <dict>
- <key>x86_64</key>
- <string>10.6</string>
- </dict>
- <key>LSRequiresCarbon</key>
- <true/>
- <key>WindowState</key>
- <dict>
- <key>bundleDividerCollapsed</key>
- <true/>
- <key>bundlePositionOfDivider</key>
- <real>0.0</real>
- <key>dividerCollapsed</key>
- <false/>
- <key>eventLogLevel</key>
- <integer>2</integer>
- <key>name</key>
- <string>ScriptWindowState</string>
- <key>positionOfDivider</key>
- <real>529</real>
- <key>savedFrame</key>
- <string>0 98 1440 780 0 0 1440 878 </string>
- <key>selectedTab</key>
- <string>result</string>
- </dict>
-</dict>
-</plist>
diff --git a/.bin/Desktop Changer.app/Contents/MacOS/applet b/.bin/Desktop Changer.app/Contents/MacOS/applet
Binary files differ.
diff --git a/.bin/Desktop Changer.app/Contents/PkgInfo b/.bin/Desktop Changer.app/Contents/PkgInfo
@@ -1 +0,0 @@
-APPLaplt-
\ No newline at end of file
diff --git a/.bin/Desktop Changer.app/Contents/Resources/Scripts/main.scpt b/.bin/Desktop Changer.app/Contents/Resources/Scripts/main.scpt
Binary files differ.
diff --git a/.bin/Desktop Changer.app/Contents/Resources/applet.icns b/.bin/Desktop Changer.app/Contents/Resources/applet.icns
Binary files differ.
diff --git a/.bin/Desktop Changer.app/Contents/Resources/applet.rsrc b/.bin/Desktop Changer.app/Contents/Resources/applet.rsrc
Binary files differ.
diff --git a/.bin/Desktop Changer.app/Contents/Resources/description.rtfd/TXT.rtf b/.bin/Desktop Changer.app/Contents/Resources/description.rtfd/TXT.rtf
@@ -1,5 +0,0 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf830
-{\fonttbl}
-{\colortbl;\red255\green255\blue255;}
-{\*\expandedcolortbl;;}
-}-
\ No newline at end of file
diff --git a/.bin/README.md b/.bin/README.md
@@ -1,20 +0,0 @@
-# My personal scripts folder
----
-## Catalog of items:
-* `anythingtogif`: converts (almost) anything to a gif. Usage: `anythingtogif clip.mov clip.gif`
-* `batteryCheck.scpt`: AppleScript that monitors battery and notifies when it's charged/empty
-* `Desktop Changer.app`: an Automator application that changes the desktop background to a random image on login
-* `epub-convert`: uses Calibre's ebook converter program to convert anything to an epub
-* `executable`: my first script. Makes any file executable, along with further options. Usage: `executable file.sh`
-* `gfx2gfx`: convert SWF into PDF. Usage: `gfx2gfx page.swf -o page.pdf`
-* `icalBuddy`: can extract information about events from the iCal application
-* `itunes_style_getter`: can find and set the genre in a track in iTunes (along with its Ruby helper). Usage: click on a track in iTunes, and run the program.
-* `modified_cfscrape.py`: can scrape and download CloudFlare-protected websites. Usage: `python3 modified_cfscrape.py http://url.com`
-* `mp3tagger.jar`: a Java application to tag MP3 files
-* `percerr.rb`: a simple tool for calculating percent error. Just run the Ruby script.
-* `strip-html-tags`: remove HTML tags from a file
-* `tag`: a command-line `mp3tagger.jar`. Usage: `tag filename.mp3`
-* `topdf`: converts a file to a PDF using cupsfilter. Works well on docx files. Usage: `topdf file [file2 file3 file4...]`
-* `upx.out`: Fixes a fucked CORE keygen. Check Info.plist in bundle. If the version is lower than system version, and the crash log says "UPX compressed binary", just run `upx.out -d $coreKeygenBinaryPath` and you good.
-* `usbmux`, `tcprelay`: port forwarding. If you want to SSH to an iPhone over USB, you can run `tcprelay 22:2222` to forward local port 2222 to the iPhone's SSH port (22), and then `ssh -p 2222 root@localhost`.
-* `wattpad-scrape`: downloads a Wattpad book as an EPUB file. Usage: `wattpad-scrape $wattpad_url`
diff --git a/.bin/anythingtogif b/.bin/anythingtogif
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-palette="/tmp/palette.png"
-
-filters="fps=24,scale=0:-1:flags=lanczos"
-
-ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
-ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
diff --git a/.bin/class-dump b/.bin/class-dump
Binary files differ.
diff --git a/.bin/clonedisk b/.bin/clonedisk
@@ -1,55 +0,0 @@
-#!/bin/bash
-
-# Disc backup/clone script
-# Requires rsync 3
-
-# Ask for the administrator password upfront
-sudo -v
-
-if [ $# -ne 2 ]; then
- echo "Usage: clonedisk [source] [destination]"
- exit 1
-else
- SRC=$1
- DST=$2
-fi
-
-EXCLUDE="clonedisk-ignore"
-
-PROG=$0
-
-if [ ! -r "$SRC" ]; then
- logger -t $PROG "Source $SRC not readable - Cannot start the sync process"
- exit;
-fi
-
-if [ ! -w "$DST" ]; then
- logger -t $PROG "Destination $DST not writeable - Cannot start the sync process"
- exit;
-fi
-
-logger -t $PROG "Start rsync"
-
-sudo /usr/local/bin/rsync --acls \
- --archive \
- --delete \
- --delete-excluded \
- --exclude-from=$EXCLUDE \
- --hard-links \
- --one-file-system \
- --sparse \
- --verbose \
- --xattrs \
- "$SRC" "$DST"
-
-logger -t $PROG "End rsync"
-
-echo -n "Make the backup disk bootable? [Y/n]: "
-read -nq shouldboot
-
-if [ $shouldboot == "y" ]; then
- # Make the backup bootable
- sudo bless -folder "$DST"/System/Library/CoreServices
-fi
-
-exit 0
diff --git a/.bin/clonedisk-ignore b/.bin/clonedisk-ignore
@@ -1,15 +0,0 @@
-.Spotlight-*/
-.Trashes
-/afs/*
-/automount/*
-/cores/*
-/dev/*
-/Network/*
-/private/tmp/*
-/private/var/run/*
-/private/var/spool/postfix/*
-/private/var/vm/*
-/Previous Systems.localized
-/tmp/*
-/Volumes/*
-*/.Trash
diff --git a/.bin/cs_record_tasks.rb b/.bin/cs_record_tasks.rb
@@ -1,21 +0,0 @@
-#!/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/.bin/epub-convert b/.bin/epub-convert
@@ -1 +0,0 @@
-/Applications/Calibre.app/Contents/MacOS/ebook-convert "$1" "${1%.}.epub"
diff --git a/.bin/executable b/.bin/executable
@@ -1,41 +0,0 @@
-# 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/.bin/gfx2gfx b/.bin/gfx2gfx
Binary files differ.
diff --git a/.bin/icalBuddy b/.bin/icalBuddy
Binary files differ.
diff --git a/.bin/itunes_style_getter b/.bin/itunes_style_getter
@@ -1,121 +0,0 @@
-#!/bin/bash
-
-if [ $# -ne 0 ]; then
- case $1 in
- "-p")
- artist=`osascript -e "tell application \"iTunes\" to return artist of current track"`;
- album=`osascript -e "tell application \"iTunes\" to return album of current track"`;
- name=`osascript -e "tell application \"iTunes\" to return name of current track"`;
- ;;
- "-s")
- artist=`osascript -e "tell application \"iTunes\" to return artist of selection"`;
- album=`osascript -e "tell application \"iTunes\" to return album of selection"`;
- name=`osascript -e "tell application \"iTunes\" to return name of selection"`;
- esac
-else
- echo "Which track?"
- select sc in "Selected" "Playing"; do
- case $sc in
- Selected)
- artist=`osascript -e "tell application \"iTunes\" to return artist of selection"`;
- album=`osascript -e "tell application \"iTunes\" to return album of selection"`;
- name=`osascript -e "tell application \"iTunes\" to return name of selection"`;
- break;;
- Playing)
- artist=`osascript -e "tell application \"iTunes\" to return artist of current track"`;
- album=`osascript -e "tell application \"iTunes\" to return album of current track"`;
- name=`osascript -e "tell application \"iTunes\" to return name of current track"`;
- esac
- done
-fi
-
-if [ -z "$album" ]; then
- # If there's no album, query without an album
- genre=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb g "$artist" "$name");
- style=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb s "$artist" "$name");
- url=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb u "$artist" "$name");
-else
- # Otherwise, add the album to query for precision
- genre=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb g "$artist" "$album" "$name");
- style=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb s "$artist" "$album" "$name");
- url=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb u "$artist" "$name");
-fi
-
-# Parsing the arrays
-# Split the Ruby arrays into Bash arrays, do some replacements to make it look nice
-IFS=',' read -ra genre <<< "${genre}"
-genre[0]=$(echo ${genre[0]} | sed -e 's/\[//') # Remove front [
-genre[$((${#genre[@]}-1))]=$(echo ${genre[$((${#genre[@]}-1))]} | sed -e 's/\]//') # Remove back ]
-
-IFS=',' read -ra style <<< "${style}"
-style[0]=$(echo ${style[0]} | sed -e 's/\[//') # Remove front [
-style[$((${#style[@]}-1))]=$(echo ${style[$((${#style[@]}-1))]} | sed -e 's/\]//') # Remove back ]
-
-IFS=',' read -ra url <<< "${url}"
-url[0]=$(echo ${url[0]} | sed -e 's/\[//') # Remove front [
-url[$((${#url[@]}-1))]=$(echo ${url[$((${#url[@]}-1))]} | sed -e 's/\]//') # Remove back ]
-
-# Give the user the source information
-echo "URL: $url"
-echo "You're changing the album \"$album\" by \"$artist\""
-printf '\n'
-
-# Select menu for genre
-echo "Genre options:"
-printf '%s\n' "${genre[@]}"
-printf "\nWould you like to use one of these?\n"
-select yn in "Yes" "No"; do
- case $yn in
- Yes)
- select opt in "${genre[@]}"; do
- case $opt in
- *)
- finalg=$(echo $opt | sed -e 's/"//g')
- if [[ $finalg = "Hip Hop" ]]; then finalg="Hip-Hop"; fi
- break;;
- esac
- done
- break;;
- No)
- echo "Write your own then:"
- read finalg
- if [[ $finalg = "Hip Hop" ]]; then finalg="Hip-Hop"; fi
- if [[ $finalg = "Post-Rock" ]]; then finalg="Post Rock"; fi
- break;;
- esac
-done
-
-# Select menu for style
-echo "Style options:"
-printf '%s\n' "${style[@]}"
-printf "\nWould you like to use one of these?\n"
-select yn in "Yes" "No" "None needed"; do
- case $yn in
- Yes)
- select opt in "${style[@]}"; do
- case $opt in
- *)
- finals=$(echo \/$opt | sed -e 's/"//g')
- break;;
- esac
- done
- break;;
- No)
- echo "Write your own then:"
- read finals
- finals="/$finals"
- break;;
- "None needed")
- break;;
- esac
-done
-
-# Finally, write the info to the iTunes track (AppleScript)
-if [ -z "$album" ]; then
- osascript -e "tell application \"iTunes\" to set the genre of every track whose name is \"$name\" and artist is \"${artist}\" to \"$finalg$finals\"" > /dev/null
-else
- osascript -e "tell application \"iTunes\" to set the genre of every track whose album is \"$album\" and artist is \"${artist}\" to \"$finalg$finals\"" > /dev/null
-fi
-
-# ...and give a status message.
-printf "\nGenre set to: $finalg$finals\n"-
\ No newline at end of file
diff --git a/.bin/itunes_style_getter_helper.rb b/.bin/itunes_style_getter_helper.rb
@@ -1,40 +0,0 @@
-require "discogs-wrapper" # Needed for API access
-
-# Remove this if sharing. This is required and unique for each user.
-my_user_token = ENV["DISCOGS_API_TOKEN"]
-
-flag=ARGV.shift # Whether searching for genre or style
-query=ARGV.join(" ") # Join the rest of the arguments into a search string
-
-# Search, and wrap the results in an array
-wrapper=Discogs::Wrapper.new("iTunesStyleGetter", user_token: my_user_token)
-res=[]
-search=wrapper.search("#{query}")
-
-# If searching for a genre
-if (flag=="g")
- search.results.each do |result|
- if result.genre? && !result.genre.empty?
- result.genre.each do |g|
- res.push("#{g}")
- end
- p res
- end
-end
-# If searching for a style
-elsif (flag=="s")
- search.results.each do |result|
- if result.style? && !result.style.empty?
- result.style.to_a.each {|x| res.push x}
- end
- p res
- end
-# If searching for url
-else
- search.results.each do |result|
- if result.style? && !result.style.empty?
- res="http://discogs.com#{result.uri}".split(" ")
- end
- p res
- end
-end-
\ No newline at end of file
diff --git a/.bin/modified_cfscrape.py b/.bin/modified_cfscrape.py
@@ -1,6 +0,0 @@
-import cfscrape, sys
-scraper=cfscrape.create_scraper()
-url=sys.argv[1]
-cfurl = scraper.get(url).content
-name = url.split('/')[-1].replace("$20", "")
-with open(name, 'wb') as f: f.write(cfurl)-
\ No newline at end of file
diff --git a/.bin/mp3tagger.jar b/.bin/mp3tagger.jar
Binary files differ.
diff --git a/.bin/percerr.rb b/.bin/percerr.rb
@@ -1,20 +0,0 @@
-#!/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/.bin/radio b/.bin/radio
@@ -1,46 +0,0 @@
-#!/bin/bash
-
-# Initial config, setting $radios and $radio_names
-if [ -e ~/.radio-config ]; then
- source ~/.radio-config
-elif [ -e ~/.config/radio-config ]; then
- source ~/.config/radio-config
-else
- echo "No radios set up. Please create a config file."
- exit 1
-fi
-
-## MAIN SCRIPT ##
-
-VISUALISER=true
-while getopts ":n" opt; do
- case ${opt} in
- n )
- VISUALISER=false
- esac
-done
-
-clear
-echo "Welcome to the command line radio player."
-PS3="Select a radio, or type q to exit: "
-select RADIO in "${radio_names[@]}"
-do
- if [[ $RADIO = "q" ]]; then
- break
- else
- for i in "${!radio_names[@]}"; do
- if [[ "${radio_names[$i]}" = "${RADIO}" ]]; then
- clear
- echo "Now playing $RADIO"
- echo "Loading..."
- if $VISUALISER; then
- nice -n 20 mpv ${radios[$i]} --script="/Users/alex/.config/mpv/visualizer.lua" --really-quiet -vo caca
- else
- nice -n 20 mpv ${radios[$i]}
- fi
- break
- fi
- done
- break
- fi
-done
diff --git a/.bin/smack.pl b/.bin/smack.pl
@@ -1,74 +0,0 @@
-#!/usr/bin/perl -w
-
-# Smackbook for Yosemite Spaces
-# ============================
-# Updated for OS X Yosemite by Steven Bock
-# stevenbockster@gmail.com
-# bocksg@plu.edu
-# November 4th, 2014
-#
-# Originally rebuilt by Jason Shen for OS X Leopard
-# iamreal2@hotmail.com
-# 16 Nov 2007
-#
-# Based on Brian Jepson's Smaxpose2.command
-# http://www.jepstone.net/blog/2006/05/25/expose-smackbook-pro-style/
-# Which is
-# Based on Erling Ellingsen's SmackBook Pro scripts:
-# http://blog.medallia.com/2006/05/smacbook_pro.html
-#
-# 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 2
-# of the License, or (at your option) 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.
-
-# =====================================================================
-
-# USAGE:
-#
-# Save this script into a file called smackleopard.command, and make
-# it executable with the Terminal command:
-#
-# chmod +x smackleopard.command
-#
-# Then, run it from the Terminal or double-click it in the Finder.
-
-use strict;
-my $stable = 0;
-
-# Get AMSTracker from Amit Singh's site:
-# http://www.osxbook.com/software/sms/amstracker/
-# and put AMSTracker in same directory as smackleopard.command
-#
-open F,"./AMSTracker -s -u0.01 |";
-while(<F>) {
- my @a = /(-?\d+)/g;
- print, next if @a != 3;
-
- # we get a signed short written as two unsigned bytes
- $a[0] += 256 if $a[0] < 0;
- my $x = $a[1]*256 + $a[0];
-
- if(abs($x) < 20) {
- $stable++;
- }
-
- # you can adjust sensitivity here
- # original file uses 30. 20 is better for me.
- if(abs($x) > 10 && $stable > 10 ) {
- $stable = 0;
-
- # check if it is LEFT or RIGHT tap
- # I use ^ArrowKeys for Leopard Spaces to switch.
- if ($x < 0) {
- `osascript -e 'tell application \"System Events\" to keystroke (ASCII character 29) using control down'`
- } else {
- `osascript -e 'tell application \"System Events\" to keystroke (ASCII character 28) using control down'`
- }
- }
-}
diff --git a/.bin/strip-html-tags b/.bin/strip-html-tags
@@ -1,4 +0,0 @@
-#!/usr/local/bin/ruby
-text = File.read("text.txt")
-newtext = text.gsub(/<\/?[^>]+(>|$)/, "")
-File.open("text.txt","w") { |file| file.puts newtext}
diff --git a/.bin/tag b/.bin/tag
@@ -1,30 +0,0 @@
-#!/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/.bin/tcprelay.py b/.bin/tcprelay.py
@@ -1,148 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-#
-# tcprelay.py - TCP connection relay for usbmuxd
-#
-# Copyright (C) 2009 Hector Martin "marcan" <hector@marcansoft.com>
-#
-# 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 2 or version 3.
-#
-# 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-import usbmux
-import SocketServer
-import select
-from optparse import OptionParser
-import sys
-import threading
-
-class SocketRelay(object):
- def __init__(self, a, b, maxbuf=65535):
- self.a = a
- self.b = b
- self.atob = ""
- self.btoa = ""
- self.maxbuf = maxbuf
- def handle(self):
- while True:
- rlist = []
- wlist = []
- xlist = [self.a, self.b]
- if self.atob:
- wlist.append(self.b)
- if self.btoa:
- wlist.append(self.a)
- if len(self.atob) < self.maxbuf:
- rlist.append(self.a)
- if len(self.btoa) < self.maxbuf:
- rlist.append(self.b)
- rlo, wlo, xlo = select.select(rlist, wlist, xlist)
- if xlo:
- return
- if self.a in wlo:
- n = self.a.send(self.btoa)
- self.btoa = self.btoa[n:]
- if self.b in wlo:
- n = self.b.send(self.atob)
- self.atob = self.atob[n:]
- if self.a in rlo:
- s = self.a.recv(self.maxbuf - len(self.atob))
- if not s:
- return
- self.atob += s
- if self.b in rlo:
- s = self.b.recv(self.maxbuf - len(self.btoa))
- if not s:
- return
- self.btoa += s
- #print "Relay iter: %8d atob, %8d btoa, lists: %r %r %r"%(len(self.atob), len(self.btoa), rlo, wlo, xlo)
-
-class TCPRelay(SocketServer.BaseRequestHandler):
- def handle(self):
- print "Incoming connection to %d"%self.server.server_address[1]
- mux = usbmux.USBMux(options.sockpath)
- print "Waiting for devices..."
- if not mux.devices:
- mux.process(1.0)
- if not mux.devices:
- print "No device found"
- self.request.close()
- return
- dev = mux.devices[0]
- print "Connecting to device %s"%str(dev)
- dsock = mux.connect(dev, self.server.rport)
- lsock = self.request
- print "Connection established, relaying data"
- try:
- fwd = SocketRelay(dsock, lsock, self.server.bufsize * 1024)
- fwd.handle()
- finally:
- dsock.close()
- lsock.close()
- print "Connection closed"
-
-class TCPServer(SocketServer.TCPServer):
- allow_reuse_address = True
-
-class ThreadedTCPServer(SocketServer.ThreadingMixIn, TCPServer):
- pass
-
-HOST = "localhost"
-
-parser = OptionParser(usage="usage: %prog [OPTIONS] RemotePort[:LocalPort] [RemotePort[:LocalPort]]...")
-parser.add_option("-t", "--threaded", dest='threaded', action='store_true', default=False, help="use threading to handle multiple connections at once")
-parser.add_option("-b", "--bufsize", dest='bufsize', action='store', metavar='KILOBYTES', type='int', default=128, help="specify buffer size for socket forwarding")
-parser.add_option("-s", "--socket", dest='sockpath', action='store', metavar='PATH', type='str', default=None, help="specify the path of the usbmuxd socket")
-
-options, args = parser.parse_args()
-
-serverclass = TCPServer
-if options.threaded:
- serverclass = ThreadedTCPServer
-
-if len(args) == 0:
- parser.print_help()
- sys.exit(1)
-
-ports = []
-
-for arg in args:
- try:
- if ':' in arg:
- rport, lport = arg.split(":")
- rport = int(rport)
- lport = int(lport)
- ports.append((rport, lport))
- else:
- ports.append((int(arg), int(arg)))
- except:
- parser.print_help()
- sys.exit(1)
-
-servers=[]
-
-for rport, lport in ports:
- print "Forwarding local port %d to remote port %d"%(lport, rport)
- server = serverclass((HOST, lport), TCPRelay)
- server.rport = rport
- server.bufsize = options.bufsize
- servers.append(server)
-
-alive = True
-
-while alive:
- try:
- rl, wl, xl = select.select(servers, [], [])
- for server in rl:
- server.handle_request()
- except:
- alive = False
diff --git a/.bin/topdf b/.bin/topdf
@@ -1,8 +0,0 @@
-#!/bin/bash
-for f in "$@"
-do
- filePathNoExtension="${f%.*}"
- textutil -convert html -output "$filePathNoExtension.html" "$f"
- cupsfilter "$filePathNoExtension.html" > "$filePathNoExtension.pdf"
- rm "$filePathNoExtension.html" > /dev/null
-done-
\ No newline at end of file
diff --git a/.bin/upx.out b/.bin/upx.out
Binary files differ.
diff --git a/.bin/usbmux.py b/.bin/usbmux.py
@@ -1,246 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-#
-# usbmux.py - usbmux client library for Python
-#
-# Copyright (C) 2009 Hector Martin "marcan" <hector@marcansoft.com>
-#
-# 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 2 or version 3.
-#
-# 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-import socket, struct, select, sys
-
-try:
- import plistlib
- haveplist = True
-except:
- haveplist = False
-
-class MuxError(Exception):
- pass
-
-class MuxVersionError(MuxError):
- pass
-
-class SafeStreamSocket:
- def __init__(self, address, family):
- self.sock = socket.socket(family, socket.SOCK_STREAM)
- self.sock.connect(address)
- def send(self, msg):
- totalsent = 0
- while totalsent < len(msg):
- sent = self.sock.send(msg[totalsent:])
- if sent == 0:
- raise MuxError("socket connection broken")
- totalsent = totalsent + sent
- def recv(self, size):
- msg = ''
- while len(msg) < size:
- chunk = self.sock.recv(size-len(msg))
- if chunk == '':
- raise MuxError("socket connection broken")
- msg = msg + chunk
- return msg
-
-class MuxDevice(object):
- def __init__(self, devid, usbprod, serial, location):
- self.devid = devid
- self.usbprod = usbprod
- self.serial = serial
- self.location = location
- def __str__(self):
- return "<MuxDevice: ID %d ProdID 0x%04x Serial '%s' Location 0x%x>"%(self.devid, self.usbprod, self.serial, self.location)
-
-class BinaryProtocol(object):
- TYPE_RESULT = 1
- TYPE_CONNECT = 2
- TYPE_LISTEN = 3
- TYPE_DEVICE_ADD = 4
- TYPE_DEVICE_REMOVE = 5
- VERSION = 0
- def __init__(self, socket):
- self.socket = socket
- self.connected = False
-
- def _pack(self, req, payload):
- if req == self.TYPE_CONNECT:
- return struct.pack("IH", payload['DeviceID'], payload['PortNumber']) + "\x00\x00"
- elif req == self.TYPE_LISTEN:
- return ""
- else:
- raise ValueError("Invalid outgoing request type %d"%req)
-
- def _unpack(self, resp, payload):
- if resp == self.TYPE_RESULT:
- return {'Number':struct.unpack("I", payload)[0]}
- elif resp == self.TYPE_DEVICE_ADD:
- devid, usbpid, serial, pad, location = struct.unpack("IH256sHI", payload)
- serial = serial.split("\0")[0]
- return {'DeviceID': devid, 'Properties': {'LocationID': location, 'SerialNumber': serial, 'ProductID': usbpid}}
- elif resp == self.TYPE_DEVICE_REMOVE:
- devid = struct.unpack("I", payload)[0]
- return {'DeviceID': devid}
- else:
- raise MuxError("Invalid incoming request type %d"%req)
-
- def sendpacket(self, req, tag, payload={}):
- payload = self._pack(req, payload)
- if self.connected:
- raise MuxError("Mux is connected, cannot issue control packets")
- length = 16 + len(payload)
- data = struct.pack("IIII", length, self.VERSION, req, tag) + payload
- self.socket.send(data)
- def getpacket(self):
- if self.connected:
- raise MuxError("Mux is connected, cannot issue control packets")
- dlen = self.socket.recv(4)
- dlen = struct.unpack("I", dlen)[0]
- body = self.socket.recv(dlen - 4)
- version, resp, tag = struct.unpack("III",body[:0xc])
- if version != self.VERSION:
- raise MuxVersionError("Version mismatch: expected %d, got %d"%(self.VERSION,version))
- payload = self._unpack(resp, body[0xc:])
- return (resp, tag, payload)
-
-class PlistProtocol(BinaryProtocol):
- TYPE_RESULT = "Result"
- TYPE_CONNECT = "Connect"
- TYPE_LISTEN = "Listen"
- TYPE_DEVICE_ADD = "Attached"
- TYPE_DEVICE_REMOVE = "Detached" #???
- TYPE_PLIST = 8
- VERSION = 1
- def __init__(self, socket):
- if not haveplist:
- raise Exception("You need the plistlib module")
- BinaryProtocol.__init__(self, socket)
-
- def _pack(self, req, payload):
- return payload
-
- def _unpack(self, resp, payload):
- return payload
-
- def sendpacket(self, req, tag, payload={}):
- payload['ClientVersionString'] = 'usbmux.py by marcan'
- if isinstance(req, int):
- req = [self.TYPE_CONNECT, self.TYPE_LISTEN][req-2]
- payload['MessageType'] = req
- payload['ProgName'] = 'tcprelay'
- BinaryProtocol.sendpacket(self, self.TYPE_PLIST, tag, plistlib.writePlistToString(payload))
- def getpacket(self):
- resp, tag, payload = BinaryProtocol.getpacket(self)
- if resp != self.TYPE_PLIST:
- raise MuxError("Received non-plist type %d"%resp)
- payload = plistlib.readPlistFromString(payload)
- return payload['MessageType'], tag, payload
-
-class MuxConnection(object):
- def __init__(self, socketpath, protoclass):
- self.socketpath = socketpath
- if sys.platform in ['win32', 'cygwin']:
- family = socket.AF_INET
- address = ('127.0.0.1', 27015)
- else:
- family = socket.AF_UNIX
- address = self.socketpath
- self.socket = SafeStreamSocket(address, family)
- self.proto = protoclass(self.socket)
- self.pkttag = 1
- self.devices = []
-
- def _getreply(self):
- while True:
- resp, tag, data = self.proto.getpacket()
- if resp == self.proto.TYPE_RESULT:
- return tag, data
- else:
- raise MuxError("Invalid packet type received: %d"%resp)
- def _processpacket(self):
- resp, tag, data = self.proto.getpacket()
- if resp == self.proto.TYPE_DEVICE_ADD:
- self.devices.append(MuxDevice(data['DeviceID'], data['Properties']['ProductID'], data['Properties']['SerialNumber'], data['Properties']['LocationID']))
- elif resp == self.proto.TYPE_DEVICE_REMOVE:
- for dev in self.devices:
- if dev.devid == data['DeviceID']:
- self.devices.remove(dev)
- elif resp == self.proto.TYPE_RESULT:
- raise MuxError("Unexpected result: %d"%resp)
- else:
- raise MuxError("Invalid packet type received: %d"%resp)
- def _exchange(self, req, payload={}):
- mytag = self.pkttag
- self.pkttag += 1
- self.proto.sendpacket(req, mytag, payload)
- recvtag, data = self._getreply()
- if recvtag != mytag:
- raise MuxError("Reply tag mismatch: expected %d, got %d"%(mytag, recvtag))
- return data['Number']
-
- def listen(self):
- ret = self._exchange(self.proto.TYPE_LISTEN)
- if ret != 0:
- raise MuxError("Listen failed: error %d"%ret)
- def process(self, timeout=None):
- if self.proto.connected:
- raise MuxError("Socket is connected, cannot process listener events")
- rlo, wlo, xlo = select.select([self.socket.sock], [], [self.socket.sock], timeout)
- if xlo:
- self.socket.sock.close()
- raise MuxError("Exception in listener socket")
- if rlo:
- self._processpacket()
- def connect(self, device, port):
- ret = self._exchange(self.proto.TYPE_CONNECT, {'DeviceID':device.devid, 'PortNumber':((port<<8) & 0xFF00) | (port>>8)})
- if ret != 0:
- raise MuxError("Connect failed: error %d"%ret)
- self.proto.connected = True
- return self.socket.sock
- def close(self):
- self.socket.sock.close()
-
-class USBMux(object):
- def __init__(self, socketpath=None):
- if socketpath is None:
- if sys.platform == 'darwin':
- socketpath = "/var/run/usbmuxd"
- else:
- socketpath = "/var/run/usbmuxd"
- self.socketpath = socketpath
- self.listener = MuxConnection(socketpath, BinaryProtocol)
- try:
- self.listener.listen()
- self.version = 0
- self.protoclass = BinaryProtocol
- except MuxVersionError:
- self.listener = MuxConnection(socketpath, PlistProtocol)
- self.listener.listen()
- self.protoclass = PlistProtocol
- self.version = 1
- self.devices = self.listener.devices
- def process(self, timeout=None):
- self.listener.process(timeout)
- def connect(self, device, port):
- connector = MuxConnection(self.socketpath, self.protoclass)
- return connector.connect(device, port)
-
-if __name__ == "__main__":
- mux = USBMux()
- print "Waiting for devices..."
- if not mux.devices:
- mux.process(0.1)
- while True:
- print "Devices:"
- for dev in mux.devices:
- print dev
- mux.process()
diff --git a/.bin/usbmux.pyc b/.bin/usbmux.pyc
Binary files differ.
diff --git a/.bin/wattpad-scrape b/.bin/wattpad-scrape
@@ -1,15 +0,0 @@
-#!/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!"
diff --git a/.bin/xld b/.bin/xld
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-#Edit this line to define a path to XLD.app
-XLD_APP="/Applications/XLD.app"
-
-if [ ! -d "${XLD_APP}" ] ; then
- echo "XLD.app not found"
- exit;
-fi
-
-"${XLD_APP}/Contents/MacOS/XLD" --cmdline "$@"
diff --git a/.oh-my-zsh b/.oh-my-zsh
@@ -1 +0,0 @@
-Subproject commit 0cec4626219bfd5a163986ebe3745fc31b593446
diff --git a/.shpotify.cfg b/.shpotify.cfg
@@ -1,2 +0,0 @@
-CLIENT_ID="7ee4bbd51eaf4846850b7382e75405d1"
-CLIENT_SECRET="91da8a9660874d2093951b4fe0f29e40"
diff --git a/commonprofile b/commonprofile
@@ -1 +0,0 @@
-.commonprofile-
\ No newline at end of file
diff --git a/.commonprofile b/commonprofile
diff --git a/gitconfig b/gitconfig
@@ -1 +0,0 @@
-.gitconfig-
\ No newline at end of file
diff --git a/.gitconfig b/gitconfig
diff --git a/zshrc b/zshrc
@@ -1 +0,0 @@
-.zshrc-
\ No newline at end of file
diff --git a/.zshrc b/zshrc