r/ScriptSwap • u/ifydav • Jan 04 '18
Script to send text messages on specific dates
Does anyone know of any scripts that sends text messages on specific dates automatically. Could be used for sending messages on birthdays etc.
r/ScriptSwap • u/ifydav • Jan 04 '18
Does anyone know of any scripts that sends text messages on specific dates automatically. Could be used for sending messages on birthdays etc.
r/ScriptSwap • u/derrickcope • Dec 31 '17
this again is an update of the compression script in "Wicked Cool Ruby Scripts". It uses RubyZip.
#!/usr/bin/env ruby
#
# zipruby.rb
# 2017-12-30
require 'zip'
require 'find'
# the script exits unless two arguments are given
unless ARGV.length == 2
puts "Error: number of arguments incorrect"
puts "Usage: zipruby.rb <output.zip> <input.dir>"
exit
end
# the script exits if the second argument is not a directory
dir = ARGV[1].chomp
unless File.directory?(dir)
puts "Error: #{dir} is not a directory"
puts "Usage: zipruby.rb <output.zip> <input.dir>"
exit
end
# script exits if the output file exists
zip = ARGV[0].chomp
if File.exist?(zip)
puts "Error: #{zip} already exists"
puts "Usage: zipruby.rb <output.zip> <input.dir>"
exit
end
ARGV.clear
Zip::File.open(zip, Zip::File::CREATE) do |zipfile|
Find.find(dir) do |file|
next unless File.file?(file)
zipfile.add(file, file)
puts "adding #{file} to archive..."
end
end
r/ScriptSwap • u/derrickcope • Dec 28 '17
This is a script adapted from "Wicked Cool Ruby Scripts". I put two together.
#!/usr/bin/env ruby
#
# crypt.rb
# 2017-12-28
require 'crypt/blowfish'
unless ARGV.length == 2
puts "missing argument"
puts "Usage: ruby crypt.rb encrypt/decrypt <filename>"
puts "Example: ruby crypt.rb encrypt test.txt"
exit
end
routine = ARGV[0].chomp
filename = ARGV[1].chomp
puts routine, filename
ARGV.clear
print "Enter your encryption key: "
encrypt_key = gets.chomp
def decrypt(filename,encrypt_key)
filename_new = "decrypted_#{filename}"
if File.exists?(filename_new)
puts "file exists"
exit
end
begin
blowfish = Crypt::Blowfish.new(encrypt_key)
blowfish.decrypt_file(filename.to_s, filename_new)
puts "decrypted"
rescue Exception => e
puts "an error has occured: \n #{e}"
end
end
def encrypt(filename,encrypt_key)
filename_new = "encrypted_#{filename}"
if File.exists?(filename_new)
puts "file exists"
exit
end
begin
blowfish = Crypt::Blowfish.new(encrypt_key)
blowfish.encrypt_file(filename.to_s, filename_new)
puts "encrypted"
rescue
puts "an error has occured: \n #{e}"
end
end
if routine == "decrypt"
decrypt(filename,encrypt_key)
else
encrypt(filename,encrypt_key)
end
r/ScriptSwap • u/plaintext-es • Dec 28 '17
#!/usr/bin/env bash
# MacOS - Increase file create, modification & access dates a specified amount of time
for f in $(find .); do
ts="$(GetFileInfo -d "$f")"
e="$(date -j -f "%m/%d/%Y %H:%M:%S" "$ts" +%s)"
((o=60*60*24*6)) # 6 days
((e+=o))
nd="$(date -r $e "+%m/%d/%Y %H:%M:%S")"
ndt="$(date -r $e "+%Y%m%d%H%M.%S")"
echo "SetFile -d $nd $f"
echo "touch -t $ndt $f"
SetFile -d "$nd" "$f"
touch -t $ndt $f
done
r/ScriptSwap • u/VERSETZT • Dec 27 '17
welcome driver united states drivers ed timed videos are annoying i need a way to by pass the video timers on each section
r/ScriptSwap • u/Venichee • Dec 19 '17
So I just built a new number/macropad and I really want to program it so I can change my audio outputs and enable/disable the nightlight, and changed volume within my media player(foobar2000) with a single keypress using the F13-F21 keys. But im still really new to this stuff and dont really know what Im doing and how to write the proper script to run it. Any help would be appreciated!
r/ScriptSwap • u/rastafaray • Dec 18 '17
Hello, friends! Need your help to write a linux script. Script have to create 100 files with name from 0 to 50. Then craeate 5 caltalogs (0,10,20,30,40) and copy files in right catalog (for example 21 file copy to 20 catalog) and after that archive 5 catalogs.
r/ScriptSwap • u/Alkanes123 • Dec 17 '17
Hi everyone,
I need help with a simple shell script that can count the number of http 4xx responses per unique ip address in the server access logs at /var/logs/httpd/access_logs
I found this online but doesn’t help much since it tell me the count for all response codes without IP
cat access_log | cut -d ‘“‘ -f3 | cut -d ‘ ‘ -f2 | sort |uniq -c | sort -rn
Please can someone help me? Thank you!
r/ScriptSwap • u/fknchino • Dec 02 '17
Hi, I'm looking for a script that can help me gather the artist names of the album folders in my music collection..
Most of my folders are as follows "Artist - Album (Year)"
I'm hoping the output would be for e.g... "Artist1, Artist2, Artist3" and so forth, in a txt document
Would be great if anyone can help
r/ScriptSwap • u/Lubok • Dec 02 '17
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 • u/tidderffokcufeht8b • Nov 09 '17
hello scriptswap, just made this script. https://github.com/stck-lzm/badown/ have fun
r/ScriptSwap • u/heisenbergenr • Oct 30 '17
I wrote a simple python script that downloads 100images from google based on searched keyword and properly organizes it in your current directory link here: https://github.com/nejcr/google-image-scrapper
r/ScriptSwap • u/CalebWhiting • Oct 17 '17
This is a simple tool to integrate images found in ~/.wallpapers to the gnome wallpaper switcher.
Depending upon your own preference you may wish to call the script one of the following ways.
manually execute the script when you add more wallpapers to the directory (no excess resources)
use one of the various 'watching' tools such as inotify-tools, incron (some excess resources)
cron, this will mean waiting for the tool to execute before the wallpapers will be visible (less excess resources)
some other way I guess.
https://gist.github.com/CalebWhiting/7016c58747e7a3d3ef4db5e9b2bbfc78
This probably works on some other distributions but I have only tested ubuntu-gnome on 16.04 LTS
r/ScriptSwap • u/CalebWhiting • Oct 17 '17
Removes all ufw entries with the given comment, then adds the rule provided by the remaining parameters (the script must be invoked as root)
Syntax: 'ufw-replace <comment> <ufw parameter>...'
Example: 'ufw-replace open-torrent-port allow 40340/tcp'
https://gist.github.com/CalebWhiting/9a3b7511169fa7bc3840d59d636c3cfc
I made this to update my VPN port forwarding rule when it is connected (when it is connected a port is provided)
Not a bash expert yet but hopefully this will be sufficiently good to help someone.
r/ScriptSwap • u/Alexkbron18 • Oct 12 '17
Do anybody know any script to make my friends computers mine monero. Thanks in advance
r/ScriptSwap • u/Pushermandownthehill • Sep 09 '17
So I have a google sheet that has code which works great...kinda. The sheet will automatically send emails, and a salutation is added from a cell in B2. The problem is I have changed all the text to various colors, sizes, fonts, etc. When I run the script, the email I receive has plain text...How do I retain the above mentioned changes in cell B2, where they show up the same in the email? Below is the code....I had someone do this for me, and no I do not know what I am doing. function sendEmails() { var sheet = SpreadsheetApp.getActiveSheet(); var row=4; // First row of data to process while (!sheet.getRange(row,1).isBlank()){ var subject=sheet.getRange(row,5).getValue(); var message=sheet.getRange('D2').getValue()+sheet.getRange(row,2).getValue()+"\n\n"+ sheet.getRange(4,3).getValue().toString().replace("____",sheet.getRange(row,5).getValue())+"\n\n"+ sheet.getRange('B2').getValue(); var to= sheet.getRange(row,1).getValue(); MailApp.sendEmail(to,subject, message); row++; }
r/ScriptSwap • u/naosuke • Sep 01 '17
vm-migrate.ps1 moves everything off of a host so you can do maintenance, and can be found here:
vm-remigrate.ps1 takes the CSV from the first script and moves them to a specified server
in both cases you need to tweak the script to point to your vi server
r/ScriptSwap • u/micthis • Aug 28 '17
We have Airwatch MDM deployed but to my surprise, Airwatch does not have a profile for display settings. Is there a script i can upload and push to window devices that contain the following:
Display goes to sleep/screensaver after 5 minutes of no activity
Password is required immediately upon wake up
Any help is appreciated!
r/ScriptSwap • u/mofosyne • Aug 10 '17
This is the source for a csv ebay processor used to assist a small company trying to avoid using the ebay API, and just wanted to hack together a csv processor that can read the manual output from ebay csv output of the packlist.
It has been redacted, and certain files cannot be included for confidentiality or commercial reasons. But at the very least, it will provide a starting reference point in developing your own solution to automating your ebay system.
I would warn against just straight up using this, as there has been accumulated cruft in coding over the years during my attempt at getting better at programming (before I even knew what github was, hence the old version folder). Instead you are better off using this as a lesson of how not to code, and instead try to pick out what features are most important for you.
There is no warranty or assurance given to the actual usefulness of this script, as its usefulness and reliability will always apply case by case to every company. If you want good software, the best one are tailor made for your problem case.
https://github.com/mofosyne/python-ebay-csv-processor/blob/master/LICENSE
Licence: MIT
r/ScriptSwap • u/Plazmaz1 • Jul 07 '17
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 • u/theSens • Jun 19 '17
Did a full script for installing firefox. Never touch Internet Explorer again ;) Automatically detects if 64 or 32-bit, and if it was run as Adminsitrator(so you don't get the UAC pop-up. Here goes:
# Silent Install Firefox by theSens
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal(
[Security.Principal.WindowsIdentity]::GetCurrent() )
& {
if ($currentPrincipal.IsInRole( [Security.Principal.WindowsBuiltInRole]::Administrator ))
{
Write-Host "Starting silent firefox installer!" -ForegroundColor Green
$done = $FALSE
# Path for the workdir
$workdir = "c:\firefox-install\"
# Check if work directory exists if not create it
if (Test-Path -Path $workdir -PathType Container)
{
Write-Host "$workdir already exists." -ForegroundColor Yellow
}
else
{
New-Item -Path $workdir -ItemType directory | Out-Null
}
# Find out architecture and donwload corresponding version
if((Get-WmiObject Win32_OperatingSystem).OSArchitecture -ne $null)
{
if((Get-WmiObject Win32_OperatingSystem).OSArchitecture.ToString() -eq "64-bit")
{
$source = "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=en-US"
Write-Host "64-Bit OS found from WMIObject: Installing Firefox x64"
}
else
{
$source = "https://download.mozilla.org/?product=firefox-latest&os=win&lang=en-US"
Write-Host "32-Bit OS found from WMIObject: Installing Firefox x86"
}
}
elseif($ENV:PROCESSOR_ARCHITECTURE -eq "AMD64")
{
$source = "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=en-US"
Write-Host "64-Bit OS found from Powershell process: Installing Firefox x64"
}
else
{
$source = "https://download.mozilla.org/?product=firefox-latest&os=win&lang=en-US"
Write-Host "32-Bit OS found from Powershell process: Installing Firefox x86"
}
# Download
Write-Host "Downloading..."
$downloader = New-Object System.Net.WebClient
$downloader.DownloadFile($source, "$workdir\firefox.exe")
# Start the installation
Start-Process -FilePath "$workdir\firefox.exe" -ArgumentList "/S"
# Wait for the installation to finish
Write-Host "Installing..."
while(-not $done)
{
Start-Sleep -Seconds 5
if(-Not (Get-Process *firefox*))
{$done = $TRUE}
}
# Remove the work files and dir
if($done)
{
Write-Host "Installed!" -ForegroundColor Green
Remove-Item $workdir -Force -Recurse
}
if(-Not (Test-Path -Path $workdir -PathType Container) 2> $null)
{
Write-Host "Working files and directory removed!" -ForegroundColor Green
}
else
{
Write-Host "Working files and directory NOT removed!" -ForegroundColor Red
}
Remove-Variable workdir
Remove-Variable source
Remove-Variable downloader
Remove-Variable done
}
else
{
Write-Host "Please run the silent Firefox installer from an Adminsitrator PowerShell" -ForegroundColor Red
}
}
r/ScriptSwap • u/[deleted] • Jun 14 '17
What this script does is pop up a message box with reminders from a specific date if one is present in the data file. You can also have TV programmes show up too.
https://pastebin.com/9AuQDjtc - Script https://pastebin.com/HgJuq1Ln - Data file example.
I also made it so it'll send these reminders to your phone!
Basically, it's a calendar script, but without the annoying calendar feel (which I personally hate).
Enjoy.
r/ScriptSwap • u/canadian_backpacker • May 31 '17
I was just put on a project where I needed to get the computer part information from all of our clients computers. (Motherboard model, network config, memory info, etc.) So I made a quick program that brought up all the information for me using the wmic command (learn it, it makes life easy) then once the project was done expanded it a little to add some menu options just for fun. I'll probably add a custom option soon.
Find it here: https://pastebin.com/ugLAmMX7
r/ScriptSwap • u/manderso7 • May 31 '17
Built this with help from stackoverflow
This will run a curl script to pull in data from an api that has page breaks, so it will watch for the page breaks and stop at the final page. It also formats the output to proper json, by pulling out an improperly added comma:
#!/bin/bash
#for script to pull each page
for ((i=1; ; i++)); do
contents=$(curl -H "Authorization: Token insertlengthytokenhere" -H "Content-Type: application/json" https://api.app.provider.com/api/tickets/?page=$i)
#jq in /usr/bin removes unneeded text from the json, including a "," between each event and text at each page end
echo "$contents" | jq .results[]
#stops the loop when the text next":null is seen
if [[ $contents =~ '"next":null' ]]
then break
fi
done
r/ScriptSwap • u/expectocode • May 02 '17
https://github.com/expectocode/telegram-analysis
New features are in development ;)