From 70b65b88ac2119600b68e1a75e3053459d171764 Mon Sep 17 00:00:00 2001 From: jbjjbjjbj Date: Fri, 13 Jan 2017 20:02:01 +0100 Subject: Added new scripts --- .Xresources | 1 + .config/terminator/config | 14 +--- .../xfconf/xfce-perchannel-xml/xfce4-panel.xml | 79 ---------------------- .zshrc | 2 + Scripts/Scanner.py | 31 +++++++++ Scripts/makeGif.py | 52 ++++++++++++++ Scripts/mayHem.py | 30 ++++++++ Scripts/overleafUp.sh | 4 ++ Scripts/pythonSocket.py | 23 +++++++ Scripts/volume-change.py | 2 + Scripts/whileUdDown.sh | 12 ++++ 11 files changed, 159 insertions(+), 91 deletions(-) delete mode 100644 .config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml create mode 100755 Scripts/Scanner.py create mode 100755 Scripts/makeGif.py create mode 100644 Scripts/mayHem.py create mode 100644 Scripts/overleafUp.sh create mode 100644 Scripts/pythonSocket.py create mode 100644 Scripts/whileUdDown.sh diff --git a/.Xresources b/.Xresources index b7c7bb1..ba1585f 100644 --- a/.Xresources +++ b/.Xresources @@ -36,3 +36,4 @@ URxvt.url-select.video: mpv URxvt.url-select.button: 1 ! Mine farver + diff --git a/.config/terminator/config b/.config/terminator/config index ee580ff..968b85b 100644 --- a/.config/terminator/config +++ b/.config/terminator/config @@ -16,26 +16,21 @@ [plugins] [profiles] [[default]] - antialias = False background_color = "#102313" - background_darkness = 0.86 - background_image = None + background_darkness = 0.92 background_type = transparent cursor_color = "#ffffff" custom_command = TERM=xterm-256color tmux - font = Terminus 10 + font = xos4 Terminus 10 foreground_color = "#ffffff" palette = "#050505:#b81109:#1cb228:#baa407:#2c5fad:#e35682:#16a085:#ffffff:#1c1b19:#e8160c:#24e534:#fcdf09:#408afc:#e02c6d:#1abc9c:#ebe3e3" - scroll_on_output = False scrollback_infinite = True scrollbar_position = hidden show_titlebar = False use_system_font = False [[Old]] - antialias = False background_color = "#100935" background_darkness = 0.49 - background_image = None background_type = transparent custom_command = tmux font = Terminus 10 @@ -45,10 +40,8 @@ show_titlebar = False use_system_font = False [[auto]] - antialias = False background_color = "#032c36" background_darkness = 0.82 - background_image = None background_type = transparent font = Terminus 10 foreground_color = "#e8dfd6" @@ -57,10 +50,8 @@ show_titlebar = False use_system_font = False [[custom]] - antialias = False background_color = "#032c36" background_darkness = 0.77 - background_image = None background_type = transparent cursor_color = "#e8dfd6" font = Terminus 12 @@ -71,7 +62,6 @@ use_system_font = False [[souceror]] background_color = "#151515" - background_image = None cursor_color = "#c2c2b0" foreground_color = "#c2c2b0" palette = "#151515:#aa4450:#719611:#ff9800:#6688aa:#8f6f8f:#528b8b:#d3d3d3:#272822:#ff6a6a:#b1d631:#87875f:#90b0d1:#8181a6:#87ceeb:#c1cdc1" diff --git a/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml b/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml deleted file mode 100644 index 3c99b12..0000000 --- a/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.zshrc b/.zshrc index 130993e..ec87098 100644 --- a/.zshrc +++ b/.zshrc @@ -93,6 +93,7 @@ alias lemon="~/.config/openbox/lemonbar | lemonbar -g 1355x20+5+5 -f terminus-9" PATH=/home/julian/Scripts:$PATH +PATH=/home/julian/.gem/ruby/2.4.0/bin:$PATH fortune -n 100 computers | cowsay rex @@ -103,3 +104,4 @@ fi alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' +alias emacs="emacs -nw" diff --git a/Scripts/Scanner.py b/Scripts/Scanner.py new file mode 100755 index 0000000..04538c4 --- /dev/null +++ b/Scripts/Scanner.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +import getch +import os + +page = 0 + +name = input("Enter name of pdf: ") + +while(1): + print("Press q for exit, Space for scanning, and d for done") + x = getch.getch() + if(x == 'q'): + exit() + elif(x == ' '): + print("Starting scan of page " + str(page+1)) + os.system("scanimage --device genesys:libusb:001:004 --format=tiff > scan" + str(page) + ".tiff") + page += 1 + print("Scan done") + elif(x == 'd'): + print("Collecting tiff pages") + os.system("tiffcp scan*.tiff magazine.tiff"); + print("Making pdf file") + os.system("convert magazine.tiff '" + name + ".pdf'") + print("Removing tiffs") + os.system("rm *.tiff") + print("Done resetting vars") + page = 0 + name = input("Enter name of pdf: ") + + diff --git a/Scripts/makeGif.py b/Scripts/makeGif.py new file mode 100755 index 0000000..5a5ac98 --- /dev/null +++ b/Scripts/makeGif.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +import sys +import argparse +import os + +parser = argparse.ArgumentParser() +parser.add_argument('-s', '--start', + required=False, + type=int, + default=0, + dest="start", + help="Time to start gif at. [0]" ) +parser.add_argument('-l', '--lenght', + required=True, + type=int, + dest="lenght", + help="Lenght of gif in seconds" ) +parser.add_argument('-i', '--infile', + required=True, + type=str, + dest="infile", + help="Movie to convert" ) +parser.add_argument('-o', '--outfile', + required=False, + type=str, + default="output.gif", + dest="outfile", + help="Output gif name. [output.gif]") +parser.add_argument('-f', '--fps', + required=False, + type=int, + default=10, + dest="fps", + help="Frames per second. [10]") +parser.add_argument('-r', '--resolution', + required=False, + type=int, + default=320, + dest="res", + help="Resolution. [320]") +args = parser.parse_args() + + +os.system("ffmpeg -y -ss " + str(args.start) + " -t " + str(args.lenght) + " -i '" + args.infile + "' -vf fps=" + str(args.fps) + ",scale=" + str(args.res) + ":-1:flags=lanczos,palettegen palette.png") + +string = 'fps=' + str(args.fps) + ',scale=' + str(args.res) + ':-1:flags=lanczos[x];[x][1:v]paletteuse' + +os.system('ffmpeg -ss ' + str(args.start) + ' -t ' + str(args.lenght) + ' -i "' + args.infile + '" -i palette.png -filter_complex "' + string + '" "' + args.outfile + '"') + +os.remove("palette.png") + +print("\n\nDONE - your file " + args.outfile + " is ready. Have a nice day :-D") diff --git a/Scripts/mayHem.py b/Scripts/mayHem.py new file mode 100644 index 0000000..6ac90d6 --- /dev/null +++ b/Scripts/mayHem.py @@ -0,0 +1,30 @@ +import os +import tkinter as tk +import time +root = tk.Tk() +root.withdraw() + +control_c_sequence = '''keydown Shift_L; +key Left; +keyup Shift_L; +keydown Control_L; +key x; +keyup Control_L +''' + +left = 'key Left' +right = 'key Right' + +def keypress(sequence): + #print(sequence.replace('\n', '')) + for item in sequence.replace('\n', '').split(';'): + print("xdotool " + item) + os.system("xdotool " + item) + + +keypress(right) +while(True): + keypress(control_c_sequence) + keypress("keydown Shift_L key " + root.clipboard_get() + " keyup Shift_L") + keypress(right) + keypress(right) diff --git a/Scripts/overleafUp.sh b/Scripts/overleafUp.sh new file mode 100644 index 0000000..59f4355 --- /dev/null +++ b/Scripts/overleafUp.sh @@ -0,0 +1,4 @@ +cd /home/julian/Dokumenter/overleaf/fysikCirkelBevægelse + +git pull +pdflatex main.tex diff --git a/Scripts/pythonSocket.py b/Scripts/pythonSocket.py new file mode 100644 index 0000000..06c434b --- /dev/null +++ b/Scripts/pythonSocket.py @@ -0,0 +1,23 @@ +import socket +sock = socket.socket() + +server_addr = ('192.168.43.86', 5001) +sock.bind(server_addr) + +sock.listen(1) +print("Waiting for connection on " + str(server_addr)) +while True: + connection, client_address = sock.accept() + try: + print ('connection from', client_address) + + # Receive the data in small chunks and retransmit it + while True: + data = connection.recv(16) + print('received ' ,data) + if not data: + print('no more data from', client_address) + break + finally: + # Clean up the connection + connection.close() \ No newline at end of file diff --git a/Scripts/volume-change.py b/Scripts/volume-change.py index 64d578a..d279ce6 100755 --- a/Scripts/volume-change.py +++ b/Scripts/volume-change.py @@ -8,6 +8,8 @@ # # Requires: python3 and python-dbus (on Arch) or python3-dbus # (on Debian) or equivalent +# +# Git link: https://github.com/garrett92895/gnome-volume-step-osd import dbus import sys from subprocess import getoutput diff --git a/Scripts/whileUdDown.sh b/Scripts/whileUdDown.sh new file mode 100644 index 0000000..2ca8f07 --- /dev/null +++ b/Scripts/whileUdDown.sh @@ -0,0 +1,12 @@ +C=1 +RED=$(curl -Ls -o /dev/null -w %{url_effective} http://uddataplus.dk) +echo "$C $RED" +COM="https://www.uddata.dk/uddataplus-nede/" +while [ "$RED" == "$COM" ] +do + C=$((C+1)) + RED=$(curl -Ls -o /dev/null -w %{url_effective} http://uddataplus.dk) + echo "$C $RED" + sleep 30 +done +notify-send 'Yo!' 'Uddata virker måske igen' --icon=dialog-information -- cgit v1.2.3