r/ScriptSwap • • Dec 11 '20

How to reuse this zsh function / make it more generic?

Thumbnail self.commandline
4 Upvotes

r/ScriptSwap • • Nov 07 '20

Scrolls the chat in sync with time of past Zoom recording

4 Upvotes

Created for myself originally because I didn't want to scroll through a chat to know what's being referred to in a past Zoom video. I'm sure some of you might find it useful. https://github.com/TheAlienDrew/Tampermonkey-Scripts/blob/master/Zoom/Zoom-Replay-Chat-Recording.user.js


r/ScriptSwap • • Oct 17 '20

[Python] Script for ranking your League of Legends team first thing during champ select

4 Upvotes

I've noticed that Riot's matchmaking is really garbage lately with tons of unranked being placed with ranked and ranks being all over the place.

Because of this, I wrote a python script to automatically look up the rank of my team and see how many people are unranked or not even close to the same level. This can predict how much of a waste of time the game will be. Not all of the script is mine, I got the screenshot function from stackexchange.

You can already do this by manually searching user names but this makes it easier and it can't be against the rules since it's not messing with the game in any way.

Note that your League of Legends GUI size in settings will need to be the medium setting for this to work. If you are using a different size, take a screenshot with Ctrl + Alt + Printscreen, paste it in to mspaint, and determine the X,Y coordinates for the top left of the summoner names and X,Y coordinates for the bottom right of summoner names. Make sure to leave ample room on the bottom right coordinates for long summoner names.

You can see the requirements you'll need to install in your python environment from the imports at the top of the script.

Here's the script:

from PIL import Image
import pytesseract
import PIL.ImageOps
#import requests
import re
import pyautogui
import win32gui
import urllib.request
import urllib.parse

def screenshot(window_title=None):
    if window_title:
        hwnd = win32gui.FindWindow(None, window_title)
        if hwnd:
            win32gui.SetForegroundWindow(hwnd)
            x, y, x1, y1 = win32gui.GetClientRect(hwnd)
            x, y = win32gui.ClientToScreen(hwnd, (x, y))
            x1, y1 = win32gui.ClientToScreen(hwnd, (x1 - x, y1 - y))
            im = pyautogui.screenshot(region=(x, y, x1, y1))
            return im
        else:
            print('Window not found!')
    else:
        im = pyautogui.screenshot()
        return im

pytesseract.pytesseract.tesseract_cmd = r'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe'
#pyautogui.hotkey('ctrl', 'alt', 'printscreen')
#im = ImageGrab.grabclipboard()


im = screenshot('League of Legends')
crop_rectangle = (90, 110, 250, 475)
image = im.crop(crop_rectangle)

width, height = image.size
image2 = image.resize((width*2, height*2))
inverted_image = PIL.ImageOps.invert(image2)
output = pytesseract.image_to_string(inverted_image)
output = output.replace("JUNGLE\n", "")
output = output.replace("SUPPORT\n", "")
output = output.replace("TOP\n", "")
output = output.replace("BOTTOM\n", "")
output = output.replace("MID\n", "")
output = output.replace("Declaring Intent\n", "")
output = output.replace("Declaring Intent\n", "")
output = output.replace("Declaring Intent\n", "")
output = output.replace("Declaring Intent\n", "")
output = output.replace("Declaring Intent\n", "")
output = output.replace("Declaring Intent", "")
output = output.replace("Declaring Intent", "")
output = output.replace("Declaring Intent", "")
output = output.replace("Declaring Intent", "")
output = output.replace("Declaring Intent", "")
output = output.replace("Declaring In:\n", "")
output = output.replace("Declaring In:\n", "")
output = output.replace("Declaring In:\n", "")
output = output.replace("Declaring In:\n", "")
output = output.replace("Declaring In:\n", "")
output = output.replace("Picking Next\n", "")
output = output.replace("Picking Next\n", "")
output = output.replace("Picking Next\n", "")
output = output.replace("Picking Next\n", "")
output = output.replace("Picking Next\n", "")
output = output.replace("Picking Next\n", "")
output = output.replace("Picking...\n", "")
output = output.replace("Picking...\n", "")
output = output.replace("Picking...\n", "")
output = output.replace("Picking...\n", "")
output = output.replace("Picking...\n", "")
output = output.replace("Picking...\n", "")
output = output.replace("Banning...\n", "")
output = output.replace("Banning...\n", "")
output = output.replace("Banning...\n", "")
output = output.replace("Banning...\n", "")
output = output.replace("Banning...\n", "")
output = output.replace("Banning...\n", "")
output = output.replace("\n\n", "\n")
output = output.replace("\n\n", "\n")
output = output.replace("\n\n", "\n")
output = output.replace("\n\n", "\n")
output = output.rstrip()
lookup = output.split("\n", 15)
for i in lookup:
	thehtml = urllib.request.urlopen('https://na.op.gg/summoner/userName=' + urllib.parse.quote(i)).read().decode('utf-8')
	reslt = re.match(r'.*TierRank\">(\w*.\d*).*', thehtml, re.DOTALL)
	if reslt and i:
		print(i + ' rank: ' + reslt.group(1))
	else:
		print(i + ' is unranked')

r/ScriptSwap • • Jul 16 '19

phoscript -Script to identify RAW files for your best JPG photos and copy a new destination

4 Upvotes

http://www.phoscript.com/publish/post/a-useful-script-to-find-your-best-photos

Script to identify your best photos folder from a trip or project which you choose and search for RAW files equivalent of your JPG files and copy them to destination you choose. Saves your time by picking the equivalent RAW files to protect and you are then free to delete all others.


r/ScriptSwap • • Jul 07 '19

[Python] Script to scrape personal ads on Reddit for statistical data

4 Upvotes

Here's the link.

It parses the titles of subreddits like /r/r4r and /r/r4r30Plus where there the titles are in a specific format. It extracts the data (such as age, sex of the OP, targeted sex, and a short description of what the OP is looking for) and places them into a CSV file for easy formatting and graphing.


r/ScriptSwap • • Apr 07 '19

[bash][pywal][i3][latex] create calendar on wallpaper

4 Upvotes

First post here...be gentle:

I thought somebody might find a similar use for this script that generates a png calendar from latex and overlays it onto the current wallpaper. This works on my system but depending on how you are setup...you know...it might not work for you.

screenshot

gencalwal - gist


r/ScriptSwap • • Jan 28 '19

Generate Output Based on Number of Characters Input?

4 Upvotes

I'm looking to make a batch file that will remove specific prefixes from files within a folder

eg. Rename "1 File1.txt" and "1 File2.txt" to File1.txt & File2.txt respectivelyThe problem is that that the length of the prefix can vary. Here is the code I have:

@echo off

Set /p Prefix = Enter the prefix to eliminate:

rename "%Prefix%*.txt" "//*.txt"

Is there a way to make the amount of slashes (characters to remove) equivalent to the amount of characters entered?


r/ScriptSwap • • Dec 08 '18

Download pics from messager chat

4 Upvotes

Looking for a way to download all the pics that were ever shared on a group chat we have on messager as by doing it manually would take ages.I thought that a script would do my job easier.


r/ScriptSwap • • Nov 15 '18

Script to ping USB on window desktop when a user plugs it in.

4 Upvotes

Hi, I'm looking for a script to ping USB flash drive to the Desktop when a user plugs their USB drive to a port. Please let me know if there is such.


r/ScriptSwap • • Nov 09 '18

Reddit TopLists: a Python 3 Script for Subreddit Moderators! (Post a top-list of users and posts for your subreddit!)

4 Upvotes

Reddit TopLists is a script I just cobbled this together, and it will be receiving regular revisions until I am happy with it.

What it does:

It posts top-ten lists of users, based on the last X posts (where X is defined by your configuration file). The top-ten lists are in the following categories:

  • Post Count

  • Average Karma per Post

  • Total Post Karma

It also includes the top-five posts from the last X posts, arranged by karma.

Planned updates:

I plan to include statistics for comments as well as posts, sorting comments by the same metrics as posts (count, total karma, and average karma) as well as the top-five comments from the last X posts.

I would love your input and ideas!


Updates:

  • Streamlining the source.


r/ScriptSwap • • Oct 31 '18

Simple script to use dictionary file to translate txt file from english to target language offline

4 Upvotes

Ive been having OCD over translating a HUGE txt file offline, been searching for solutions for 7 hours now. Tried ALL translator tools that are out the(that i could find) that work with dictionary files, but none was able to translate the whole document. Computing power is no issue, and it doesnt need to be perfect or even good quality. It just need to work and do a decent job.

I read on a forum, a post from 2011 of a guy that had such a script and shared it thru PM. Gone now tho.

I dont know linux well at all so i dont know how to get this running, anyone that could point me in the right direction? Would greatly appreciate it!


r/ScriptSwap • • Aug 27 '18

Script to change Outlook calendar category colour name?

4 Upvotes

Hi all,

In outlook you can change the category colour (Red Category) to a name like Red = Meeting. Is there a way I could make a script to do this? We get new guys in all the time and it would be great to have a script they could run and all of their stuff would be setup right away.

Can anyone give any guidance or resources I could use to write this?

Thanks!


r/ScriptSwap • • Aug 07 '18

Force DNS settings (I need some help, Please)

4 Upvotes

I am in a bit of a bind, I am setting up a computer to be a kiosk in the office of my apartment complex. I must use specific DNS servers to filter explicit content, however Ubuntu Mate 18.04 changes all my settings back to default on reboot. I am still trying to get to the bottom of why but until then I would like to know if someone has a script that I can run on boot that will change the dns back to FamilyShield after Ubuntu wipes out my changes on boot. I am an unpaid volunteer just trying to make a computer usable for some people who need it, any help would be greatly appreciated.


r/ScriptSwap • • Apr 26 '18

Linux script for Apache logs..

4 Upvotes

I have the apache access logs. I want a list of IPs sorted by number of accesses they have made (count) but not the count number. Just the ip addresses sorted by access counts.

I have this command I've found:

cat access_log | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -200 > output.txt

This gives an output like:

10090 61.249.79.18

10090 is the count number. I need the IP only not the count. What is the modified command then? Thanks!


r/ScriptSwap • • Feb 09 '18

An ffmpeg file converter.

4 Upvotes

A little bash script for converting stuff from one media format to another. Any advice or critique is welcome.

Here it is.

EDIT: Stopped being lazy and edited it to check if the source format and desired format are different based on /u/Blissfull .


r/ScriptSwap • • Jan 11 '18

Meet Bashlets, yet another Bash library project

4 Upvotes

Bashlets is a new modular extensible Bash library written in Bash! The project is still in its early days, yet it is quite usable and the core features are already there: smart loading of modules, integration with git, partial OO support, and more. But of course there is so much work to do, and I'd be delighted if somebody is willing to step in with code, enhancements, suggestions, and of course test cases and bug reports! Bashlets home is at https://github.com/bashlets/bashlets.


r/ScriptSwap • • Dec 02 '17

[python] Linux context menu reverse image search

4 Upvotes

Not exactly well tested, but should work from any linux gui file manager and from terminal. https://github.com/Unknowny/Linux-Context-Image-Search/


r/ScriptSwap • • Sep 01 '17

Powershell: Pair of scripts to move VMs off of ESXI host and back

4 Upvotes

vm-migrate.ps1 moves everything off of a host so you can do maintenance, and can be found here:

https://pastebin.com/KxLVPjcR

vm-remigrate.ps1 takes the CSV from the first script and moves them to a specified server

https://pastebin.com/m7t7ZA58

in both cases you need to tweak the script to point to your vi server


r/ScriptSwap • • Jul 07 '17

[Bash] One-line netcat HTTP logger with sane logging

4 Upvotes

I needed this for testing some HTTP requests and figured I'd share it here. This code will respond with an empty HTTP response and log all requests to a file, "log.txt". It also removes some generally unuseful headers like "Content-Length" and "Host". https://gist.github.com/Plazmaz/cafd0bd3a3a4471446cc8fe6e4f0c036


r/ScriptSwap • • Dec 01 '16

[Bash] A script to automate the setup of a Ubuntu server

4 Upvotes

Hi, I made this little script as a hobby project. It automates the setup of a Ubuntu server.


r/ScriptSwap • • Jul 22 '16

Windows 10 Enable/Disable Hotspot Script

4 Upvotes

Needing help writing a batch file to enable the Hotspot feature for Windows 10. We will be installing this on multiple PC's so need the SSID to show up as the computer name of that particular device. Would someone be able to write/help me out? Any and All help is appreciated!


r/ScriptSwap • • Jul 19 '16

Fuzzy git file adder based on fzf

4 Upvotes

Add the script to path and then git fza somefile

https://github.com/dufferzafar/.scripts/blob/master/git-fza


r/ScriptSwap • • Jun 24 '16

https://github.com/welldan97/nodebug Catch debug code before you commit

4 Upvotes

https://github.com/welldan97/nodebug

I've made this script to help myself and developers in the team, catch letftover debug code(happens all the time). So far it's just for ruby/js. I hope you can find it useful. Cheers.


r/ScriptSwap • • Jun 19 '16

Instant Movie Streamer: Streams the movie/ tv series instantly.

4 Upvotes

r/ScriptSwap • • Feb 26 '16

[Request]Edit my script so it shuts itself down when a program is closed.

4 Upvotes

@ECHO OFF TITLE Call of Duty Black Ops III START "" "C:\Program Files (x86)\Steam\steamapps\common\Call of Duty Black Ops III\BlackOps3.exe" :1 TIMEOUT /T 10 /NOBREAK >NUL WMIC PROCESS WHERE NAME="BlackOps3.exe" CALL SETPRIORITY 128 >NUL GOTO 1

This is the script, I want the script to close itself when BlackOps3.exe is closed.