Do you write your own .bat/.sh files to deal with menial everyday tasks on your computer?
If yes, What kind of tasks do they perform?
If no, why won't you make your life easier?
Do you write your own .bat/.sh files to deal with menial everyday tasks on your computer?
Other urls found in this thread:
wiki.archlinux.org
twitter.com
Yes.
Yes. I'm going to dump some of them.
#!/bin/bash
day=$(date +%F%R%S%s)
Folder=$1
BACKUPDIR=$2
if [[ $# -ne 2 ]]; then
echo "This script takes in only 2 parameters. Exiting...."
exit 0;
fi
if [[ -d $BACKUPDIR ]]; then
File="$BACKUPDIR/$day.tar.bz2"
elif [[ ! -e $BACKUPDIR ]]; then
mkdir -p $BACKUPDIR
File="$BACKUPDIR/$day.tar.bz2"
elif [[! -d $BACKUPDIR ]]; then
echo "$BACKUPDIR exists but isn't a directory"
exit 0;
fi
if [[ -d "$Folder" ]]; then
tar -cvpjf $File $Folder
find $File* -mtime +7 -exec rm {} \;
elif [[ ! -d $Folder ]]; then
echo "$Folder exists but isn't a directory"
exit 0;
elif [[ ! -e $Folder ]]; then
echo "Invalid directory name"
exit 0;
fi
Works great with cron
Forgot to say that this was my backup script
Here's my youtube-dl script:
#!/bin/bash
CURRENT=$PWD
VIDEODIR=$1
FILELOC=$2
INDEX=$3
if [[ $# = 2 ]]; then
if [[ -d $VIDEODIR ]]; then
cd $VIDEODIR
elif [[ ! -d $VIDEODIR ]]; then
echo "$VIDEODIR exists but isn't a directory"
exit 0;
elif [[ ! -e $VIDEODIR ]]; then
mkdir -p $VIDEODIR
cd $VIDEODIR
fi
read -p "Download playlist [1] or individual videos [2]? " answer
if [[ $answer = 1 ]]; then
echo "$(
And my Sup Forums image downloader script:
#!/bin/bash
CURRENT=$PWD
VIDEODIR=$1
CHANURL=$2
CHAN=$3
if [[ $# -ne 3 ]]; then
echo "This script takes in only 3 parameters. Exiting...."
exit 0;
fi
if [[ -d $VIDEODIR ]]; then
cd $VIDEODIR
elif [[ ! -d $VIDEODIR ]]; then
echo "$VIDEODIR exists but isn't a directory"
exit 0;
elif [[ ! -e $VIDEODIR ]]; then
mkdir -p $VIDEODIR
cd $VIDEODIR
fi
echo "$(
I like powershell for automating tasks.
just some trivial script to expedite the launching of wine applications mostly.
Like,
APP_PATH="/whatevs"
APP_BIN="app.exe"
WINEBIN=wine
export WINEDEBUG=-all
RESOLUTION=1366x768
cd $APP_PATH
xrandr --output monitor1 --mode $RES
$WINE $APP_BIN
xrandr --output monitor1 --mode 1920x1080
>.bat files
Never.
>.sh files
Yes.
I use Windows at home, but fortunately I don't have many menial tasks to do on my personal computer. At work I use Linux. I have .sh scripts to automate some common stubby calls I need to make so I don't have to type them out, that's about it.
Gay
I want to make a windows script to move files from one folder to another every boot, with a whitelist of files that remain. No idea where to start though.
generating passwords for stuff:
randpw() { < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo; }
sending crap to sprunge
sprunge() { curl -F 'sprunge=
>see OP image
>remember watching The Love Boat in the late 1970s/early 1980s
GOD DAMMIT, OP, NOW I'M GONNA HAVE THAT FUCKING THEME SONG IN MY HEAD ALL GOD DAMNED DAY, YOU FUCKING BASTARD.
>generating passwords
oh I know the code for that
echo butter
I have this service that monitors changes to a directory:
import sys, time, logging, json, socket, handlers
from logging.handlers import SysLogHandler
from watchdog.observers import Observer
threads = []
with open('conf.json') as fp:
_file = json.load(fp)
paths = _file['directories']
event_handlers = _file['handlers']
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
log_handler = SysLogHandler(address='/dev/log')
logging.getLogger().addHandler(log_handler)
observer = Observer()
for x in paths:
target = str(x)
for h in event_handlers:
event_handler = getattr(handlers, h)()
observer.schedule(event_handler, target, recursive=True)
threads.append(observer)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()
the handlers in the handlers module have an action for files if they create/update/delete/move. The handlers can include logic like only watching for *.py files.
in this way, If I want to drop some file in a folder, I can have actions taken on the file automatically. Lets say the handler takes a python file i drop into a directory and runs a series of unit tests on it. Sorta handy. If anybody wants to see a handler example I can post.
Sure.
lol i forgot about sprunge
sprunge?
I automate robocopy with batch scripts to do my backups.
I connect my phone and run the sricpt, It saves my camera pics, my contacts, my messenger pics and so on.
Comfy shit
I have a script that launches sopcast with mplayer for certain romanian channels like
./player.sh protv
./player.sh antena3
.player.sh primatv
etc
fucking phone
meant to reply to sprunge is online storage for small, public files geared for cli
What's so interesting about gypsie media?
Yes, i wrote some scripts to do animu-related tasks senpai.
Yes
Mostly dealing with formatting the text in my clipboard
>tar
>no data deduplication
>no version control
pls user, have a look
wiki.archlinux.org
I have various .bat's for youtube-dl. Other than that, no, since Windows has good software.
Huh, thanks for pointing that out user. I guess I'll use rsync instead of tar.