r/ScriptSwap • • Mar 18 '15

[sh] grml-dash-config, a parody of grml's zsh config written for dash

2 Upvotes

https://github.com/ScoreUnder/grml-dash-config

I wrote this some time ago, mostly as a joke. I thought it might be cool to find someone who left their workstation unattended and "exec" into this from any open zsh sessions they have. Perhaps that was an evil thought.

Anyway, if you've ever tried the dash shell (comes preinstalled on debian/ubuntu), you'll know that it's really minimal - to the point that it doesn't even understand what arrow keys are for. This script uses rlwrap (you might have to install that) and a custom rc file to make it a little more convincing and make it look a little like grml's zsh config. It even shows what branch you're on in git repos and the like.


r/ScriptSwap • • Nov 29 '14

[REQUEST] Parse HTML from company financial statements

2 Upvotes

Hello,

I am wondering if someone could help me develop a script to parse data from an HTML table like the ones here (see item 8, the income statement). Basically what I'm trying to do is pull that data (net income, revenue, various expenses etc) into a google spreadsheet so that I can run some calculations on it.

I wrote a similar script in Python a while ago that scraped data from Yahoo Finance's financial statements but it is dependent on Yahoo's formatting and I would trust that the default formatting from Edgar is much more likely to remain the same than Yahoo's, though Yahoo hasn't changed theirs in a while either.

Anyway just looking for some guidance or advice if anyone has a better way to do this. Basically I have a series of checks I want to perform against revenues, profit margins, various ratios, etc and it would be much easier to run those checks if I could use the raw financial data in my spreadsheet. Most of the APIs I have found (Yahoo Finance, Morningstar, Google Finance so far) only provide quote data like bid, ask, close, open, % change, and basic fundamental data like PE ratio and the like. Also they don't provide any access to historical data unless it is quote data, so I can't determine any trends in fundamental data.

Ok, hopefully that's enough info. Any advice? Thanks!!!

Chris


r/ScriptSwap • • Oct 21 '14

[bash] Down-sample excessive quality videos, preserving dual/multiple audio and subtitles

2 Upvotes

I'm sure it could be improved, but this works and consistently realizes 75-90% filesize reduction.

NOTE: The current state uses a lot of automagic so it's heavily dependent on your hardware for output quality. Anything modern should do well though.

Certain files or batches can have weird audio codecs (may wish to delete the "a" arguments if something goes awry), and mp4 usually goes very poorly into mkv (better off changing output to mp4), so probably the best approach is to copy a textfile into the working directory (or a testing subfolder) and tweak it as needed.

If you want to improve an especially good picture or audio track, change "vga" to "xga" or "48k" to "72k." Finally, this script deletes the source file upon completion but remove && rm "$f" and it won't. It also currently appends "-FIX" to the end of the filename but you can change that too.

-

for f in *.mkv; do avconv -i "$f" -map 0 -s vga -c:a ac3 -b:a 48k -c:s copy "${f%.mkv}-FIX.mkv" && rm "$f"; done

r/ScriptSwap • • Jun 19 '14

[Python 3] Quick and dirty script to download .jpg images from a target webpage

2 Upvotes

A quick and dirty script to download all .jpg images from a target webpage using BeatifulSoup. I say quick and dirty becuase in it's current form, it will only download images that have a complete url in the <img src='...'> tag; relative links will be ignored. It wouldn't be too hard to fix, but the site I wrote this for didn't have this limitation.

#!/usr/env/bin python3

'''
script to pull .jpg images from target web-page
'''

import urllib.request
import re
from bs4 import BeautifulSoup

target_site = 'http://www.reddit.com'

#request page and give response to BeatifulSoup
f = urllib.request.urlopen(target_site)
content = f.read()
f.close()
soup = BeautifulSoup(content)

#filter soup for jpeg image urls only
img_list = []
for img in soup.find_all('img'):
    search_obj = re.search('http(.*jpg)', str(img))
    try:
        img_list.append(search_obj.group())
    except:
        pass

#function to download images
def request_img(img):
    filename = img.split('/')[-1]
    g = urllib.request.urlopen(img)
    with open(filename, 'b+w') as h:
        h.write(g.read())
    

#send image list through request_img function
for img in img_list:
    request_img(img)

r/ScriptSwap • • Jun 08 '14

[Python] Mass mailer I wrote when I was a skid

2 Upvotes

Figured I should put it here for educational purposes. It uses standard libraries for what I know. Python version is 3.x

https://gist.github.com/Vincentdc94/f175a89c4368b3c82380


r/ScriptSwap • • Apr 21 '14

[Request] Click on image when it pops up

2 Upvotes

Theres a game where its basically a room with a background, and you have a character you move to a position by clicking. In this room a ball pops up on a tile and you can collect it by standing on it. So the script would be to find the ball once it appears, move the cursor to that ball, and then click. All the balls look the same, and this is web based and secure so I cant really break into the coding.


r/ScriptSwap • • Nov 05 '13

[Request] A seasonal league script

2 Upvotes

Hello,

I'm looking to create an online league for a particular video-game that can be split into separate divisions (ie. East, West, Euro). The league will run seasonally, much like a football season operates, with a set number of matches per-season before a playoff bracket began. This league would operate much like the old Cyber Athlete League if any of you are familiar with it.

Are there any scripts like this in existence which I can purchase or use as a foundation for the platform I'm attempting to build? Thank you.


r/ScriptSwap • • Mar 02 '13

Reddit Title Passthrough [x-post GreaseMonkey]

2 Upvotes

This little script will "passthrough" the Reddit title to the resulting page. When the linked page is loaded, the title of the page will now be the Reddit Title, and the original page title.

You can choose to not have the original page title appear after the Reddit title, by adding a comment to line 40.

I find this is useful when viewing imgur photos. Often, the subsequent page is just an image file, with no useful title information to go along with it.

https://github.com/tcomben/Reddit-Title/raw/master/user-script.user.js

GitHub page: https://github.com/tcomben/Reddit-Title


r/ScriptSwap • • May 14 '12

[python] playlist creates a .pls playlist file for a directory of music

2 Upvotes

This is my attempt at a unix style command using python:

It can recieve a directory through stdin (pwd | playlist) or through an argument (playlist /home/user/Music/album).

The music files in the folder have to start with a number, followed by a space.

I've only tested with my Linux Mint 11 computer, and it has been greatly convenient for organizing my albums of music into single lists.

Let me know how it works for you!

https://raw.github.com/ckatzer4/playlist/master/playlist

Just save the script and make it executable.


r/ScriptSwap • • Mar 26 '12

Scripts to do basic testing for a computer.

2 Upvotes

This script will open up the basics on most new computers to do a test. Webcams, Connect to a wireless router open an mp3 file and mic and so on. I made this because I restore and then have to test 60 different units a day and then sysprep them to go back to store level and be resoled.

@ECHO OFF
SET /P drive_let=What is the drive letter? %=%
netsh wlan add profile filename="%drive_let%:(location of wifi info.xml)"
mmc devmgmt.msc
"%drive_let%:(location of mp3)"
%SystemRoot%\system32\SoundRecorder.exe
"C:\Program Files (x86)\CyberLink\YourCam.exe"
"C:\Program Files (x86)\TOSHIBA\TOSHIBA Web Camera Application\TWebCamera.exe"
"C:\Program Files (x86)\ArcSoft\WebCam Companion 3\uWebCam.exe"
"C:\Program Files (x86)\Lenovo\YouCam\YouCam.exe"
"%drive_let%:\bat files\Web Conferencing - Shortcut.lnk"
"%ProgramFiles (x86)%\Acer\Acer Crystal Eye Webcam\webcam.exe"
"C:\Program Files (x86)\Hewlett-Packard\Media\Webcam\HPMediaSmartWebcam.exe
"C:\Program Files\Acer|acer Crystal Eye Webcam\WebCam.exe" notepad
taskkill /IM wmpnetwk.exe /f
%SystemRoot%\System32\sysprep\sysprep.exe

This is all on a flash drive I carry around with me all day. In the flash drive I have a folder call "Bat Files" I keep an mp3 and the wifi info there.

This is code is to be covered under the GPL License Thanks. Any updates are welcome.

Edit: I also have this one to reseal a Mac if it has one user with the name "user"

/sbin/mount -uw /
rm /var/db/.AppleSetupDone
launchctl load
/System/Libarary/LaunchDaemons/com.apple.DirectoryService.plist
dscl . -delete /Users/user
dscl . -delete /Groups/admin GroupMembership user
rm -rf /var/db/netinfo/local.nidb
rm /var/db/dslocal/nodes/default/users/user.plist
rm -rf /Users/user
rm /var/db/.applesetupdone
rm /root/.bash_history
rm /resealing.sh
reboot


r/ScriptSwap • • Mar 02 '12

[Jquery]A countdown timer that gets as close as possible to counting milliseconds.

2 Upvotes

HTML --

<html>
    <head>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
         <script type="text/javascript" src="countdown.js"></script>
    </head>

    <body>
        <span id="timer_day"></span> : 
        <span id="timer_hour"></span> :  
        <span id="timer_minute"></span> : 
        <span id="timer_second"></span> : 
        <span id="timer_millisecond"></span> : 
    </body>
</html>

Jquery --

var countLag = 30;

$(document).ready( function() {

    var now 			= new Date();
    var now_timestamp	= now.getTime();
    var then 			= new Date( 'December 21, 2012 00:00:00');
    var then_timestamp	= then.getTime();

    var diff = 0;
    var diff_millisecond 	= 0;
    var diff_second			= 0;
    var diff_minute			= 0;
    var diff_hour			= 0;
    var diff_date			= 0;

    var diff_timestamp = then_timestamp - now_timestamp;
    var remainder = 0;

    if( diff_timestamp > 0) {
        remainder = diff_timestamp % 1000;
        diff_timestamp -= remainder;
        diff_timestamp /= 1000;
	
        if( diff_timestamp > 0) {
            remainder = diff_timestamp % 60;
            diff_timestamp -= remainder;
            diff_timestamp /= 60;
            diff_second = remainder;
                
            if( diff_timestamp > 0) {
                remainder = diff_timestamp % 60;
                diff_timestamp -= remainder;
                diff_timestamp /= 60;
                diff_minute = remainder;
                
                if( diff_timestamp > 0) {
                    remainder = diff_timestamp % 24;
                    diff_timestamp -= remainder;
                    diff_timestamp /= 24;
                    diff_hour = remainder;
                    diff_date = diff_timestamp;
                }
            }
        }
    }

var dayLocation 		= $('#timer_day');
var hourLocation 		= $('#timer_hour');
var minuteLocation 		= $('#timer_minute');
var secondLocation		= $('#timer_second');
var millisecondLocation	= $('#timer_millisecond');

dayLocation.html( diff_date);
hourLocation.html( diff_hour);
minuteLocation.html( diff_minute);
secondLocation.html( diff_second);
millisecondLocation.html( diff_millisecond);

millisecondChange();

});

function millisecondChange() {

    var millisecondLocation	= $('#timer_millisecond');

    if( millisecondLocation.html() < 0) {
        millisecondLocation.html( 1000 - countLag);
        timeChangeChain();
    }
    else millisecondLocation.html( parseInt( millisecondLocation.html()) - countLag);
    setTimeout( millisecondChange, countLag);
}

function timeChangeChain() {

    var dayLocation 		= $('#timer_day');
    var hourLocation 		= $('#timer_hour');
    var minuteLocation 		= $('#timer_minute');
    var secondLocation		= $('#timer_second');

    if( secondLocation.html() == 0) {
            if( minuteLocation.html() > 0) {
                secondLocation.html( 59);
                minuteLocation.html( minuteLocation.html() - 1);
            } else {
                if( hourLocation.html() > 0) {
                    minuteLocation.html( 59);
                    hourLocation.html( hourLocation.html() - 1);
                } else {
                    if( dayLocation.html() > 0) {
                        hourLocation.html( 23);
                        dayLocation.html( dayLocation.html() - 1);
                    }
                }
            }
    } else {
            secondLocation.html( secondLocation.html() - 1);
    }
}

This trick is figuring out what to set countLag high enough so that your browser can change the DOM elements without losing time, but low enough so that it looks like milliseconds are flying by.

There are probably lots of things I could do to make countLag lower. Like not using jQuery. I'm curious if anyone wants to take up the challenge.


r/ScriptSwap • • Mar 02 '12

[bash] Batch convert (flac|mp3) to ogg

2 Upvotes

dependencies: oggenc mpg321

usage:

./x2ogg 140 music/ music/

It should search for all supported music files (flac and mp3) in the top level of music/ then compress them to 140kbps VBR then put them in music/vorbis_r140

#!/bin/bash
# x2ogg
# $1 - average bitrate (VBR)
# $2 - source directory
# $3 - destination directory

rate=$1

supported="mp3 flac"
jobname=vorbis_r$rate
ext=ogg
indir=${2%/}
outdir=${3%/}/$jobname

printerr() { echo >&2 $1; exit 1; }

test_exist() {
# look in $1 for files that end with .$2
# return true if any matches were found
  files=`find "$1" -type f -iname "*.$2" | wc -l`
  return `test "$files" != "0"`
}

# check dependencies
hash oggenc 2>&- || printerr "oggenc requred. Aborting."
hash mpg321 2>&- || printerr "mpg321 requred. Aborting."

# verify existence of input directory and any supported files
test -d "$indir" || printerr "Input directory not found. Aborting"
found=0
for ext_i in $supported; do
  test_exist "$indir" "$ext_i" && { (( found++ )); echo "found $ext_i"; }
done
test $found -eq 0 && printerr "No supported input types found."


mkdir $outdir

# PROCEDURE: mp3
for input in $indir/*.mp3; do
  output=$outdir/`basename "$input" .mp3`.$ext
  mpg321 "$input" -w - | oggenc - -b $rate -o "$output"
done

# PROCEDURE: flac
for input in $indir/*.flac; do
  output=$outdir/`basename "$input" .flac`.$ext
  oggenc "$input" -b $rate -o "$output"
done

can anybody find bugs or add functionality for more input filetypes?


r/ScriptSwap • • Mar 02 '12

[PHP]Kill all MySQL Queries/Threads/Processes

2 Upvotes

This stemmed back from a website I was managing where they had a poorly written download database that would never release connections from the database and ended up in queries being stuck....someone learned of this and would occasionally flood it this way causing the server to lock up so I wrote this little cron job to terminate the connections until the programmer fixed it in the code.

<?php
 
$con = mysql_connect( "localhost", "root", "<password>" ) or die( "can not connect" );
if( $con ) echo "Connected<br>";
 
$result = mysql_query( "SHOW FULL PROCESSLIST", $con );
while( $row = mysql_fetch_array( $result, $con ) )
{
 
	$process_id = $row["id"];
	if( $row["Info"] == "NULL" )
	{
		$sql = "KILL $process_id";
		$res = mysql_query( "$sql", $con );
		if( $res )
		{
			echo "Mysql Process ID $process_id has been killed<br>";
		}
	}
	else echo "Row not found?<br>";
}
?>

http://ckozler.net/?p=3


r/ScriptSwap • • Jul 29 '25

Can someone make a script to remove all my Fortnite friends but filter out or exclude a few?

1 Upvotes

I have over 400 friends.


r/ScriptSwap • • Sep 15 '23

Flash drive

1 Upvotes

Theoretically! Is there a script you can add to a normal flash drive to make it save the chrome saved passwords and or be able to do it on a laptop for example a chromebook.


r/ScriptSwap • • Sep 11 '23

Looking for a script that can change link from reddit share to post to my profile

1 Upvotes

i share posts that i like but irritated by selecting my profile in the page everytime i want to share a post

https://www.reddit.com/submit?source_id=post-id TO

https://www.reddit.com/user/username/submit?source_id=t3_16d8b45


r/ScriptSwap • • Jun 23 '23

I need a script but have no idea on how to make them

1 Upvotes

I need the script to make a character in gta5 go to where ever the point marked on the map is weather they are in a vehicle or not
if it is going to cost something pm me and I will get back to you


r/ScriptSwap • • Jun 10 '20

Need help with tracert and choice

1 Upvotes

I need batch script for school but I dont know how to do it. I am using virtual box Win xp on macos and choice is just not working. Maybe someone can write an easy script with traceroute and choice commands?


r/ScriptSwap • • Apr 24 '19

looking for a person to write custom script/website (GOG.com related)

1 Upvotes

first of all i apologize if it is not the place, but i couldnt find any place better and i couldnt see any rules against it.

I am basically trying to get a website script that has some basic custom information with the game information it gathers from gog.com and gogdb.org. it can be for free or paid. can anyone show me the way to get that kind of scripts or if you think you can create such a website, can you please contact me?


r/ScriptSwap • • Feb 27 '19

New to scripting, assistance wanted

1 Upvotes

I've been looking at how to create a script to perform a specific task:

When Scroll Wheel Up is "scrolled", I would like the C key to be held while the Spacebar key is pressed.

I am having trouble understanding the right commands to have my Logitech mouse run.

Any help would be appreciated; thank you!


r/ScriptSwap • • Nov 18 '18

Vimscript Solution to Maintaining Comment Boxes

1 Upvotes

Comment boxes are visually appealling but hard to maintain. In this post, I recommend a vimscript solution that makes comment boxes a viable option again: https://bryanbugyi.com/blog/creating-comment-boxes-in-vim/


r/ScriptSwap • • Aug 07 '18

Script PUBG TslGame folder to a different storage?

1 Upvotes

Hi, Is there any script out there or can anyone please write a script to move TslGame folder automatically PUBG demos to external storage?

thx!


r/ScriptSwap • • Jul 11 '18

Is there any working instagram scraper out there?

1 Upvotes

I don't know if this belongs here but I'll just try.

I am looking for a script that can scrape the images of instagram users.

I started using this python script https://github.com/rarcega/instagram-scraper but it keeps running into 429 Errors and failed Logins since instagram has a limit for queries and detects bot behaviour.

Limiting the max downloads and setting up timeouts didn't solve the issue.

So does anyone know of a script that is working with instagram's latest API restrictions?

Thanks


r/ScriptSwap • • Jun 27 '18

PHP Fatal Error Help?

1 Upvotes

I work for a non-profit with unreliable tech guys and so I seek the wisdom of the gods today. Besides our main web page, all of our additional web pages on our website oneidacommunity.org won't open as a result of a PHP Fatal Error.

The full script reads:

PHP Fatal error: require_once(): Failed opening required '/var/www/vhosts/oneidacommunity.org/httpdocs/sites/default/files/a.jpg' (include_path='.:') in /var/www/vhosts/oneidacommunity.org/httpdocs/includes/bootstrap.inc on line 2509

I was going to plow on ahead and try to fix it myself, but I would greatly appreciate any insights the community could offer. :)


r/ScriptSwap • • Apr 03 '18

Script for suspending bitlocker help

1 Upvotes

I have a project for work regarding updating the Bios to the latest firmware, which requires to flash it twice. So to make things easier I wanted to create a powershell script where I have a input.txt to add our host names to. An optional feature I wanted to add was any PC I couldn't ping would create a txt file with the computers that aren't on the network. Here is what I have so far......

Set-StrictMode -version 2 $ErrorActionPreference = 'stop'

Requires -RunAsAdministrator

function IsPingable { param ([string]$HostnameToPing)

[boolean]$blnIsPingableFn = Test-Connection -ComputerName $HostNameToPing -quiet -Count 2
return $blnIsPingableFn

}

$InputFile = Get-Content C:\Input.txt

forEach ($PC in $InputFile) { If (IsPingable -HostnameToPing $PC -eq $True)

        {
            Write-Host "$PC is online" -ForegroundColor Green
         manage-bde.exe -protectors -disable c:
        }
    Else
        {
            Write-Host "$PC Is offline" -ForegroundColor Red
        }
}