OTTHUNDERDOME I : THE THUNDERVAULT - HOME OF THE GOODS
Would you like to react to this message? Create an account in a few clicks or log in to continue.

baby's first program

5 posters

Go down

baby's first program Empty baby's first program

Post by admin Thu Aug 01, 2013 3:06 pm

im making a little script to automagically download all of my avatars on forumotion

look at this quality shit:

Code:
export itsautomated=0
while true; do
export itsautomated=`expr $itsautomated + 1`
if [ $itsautomated == 100 ]; then exit; else wget http://r29.imgfast.net/users/3417/17/08/55/avatars/1-$itsautomated.png; fi
done

tabs are for pussies


Last edited by ammy on Thu Aug 01, 2013 3:11 pm; edited 1 time in total
admin
admin
ETERNAL PRESIDENT OF THE REPUBLIC

Posts : 41616
money : -420000486
bitches : -5361
Join date : 2012-11-18
Age : 27
Location : music is better than popping pills

Back to top Go down

baby's first program Empty Re: baby's first program

Post by admin Thu Aug 01, 2013 3:09 pm

it works perfectly though
admin
admin
ETERNAL PRESIDENT OF THE REPUBLIC

Posts : 41616
money : -420000486
bitches : -5361
Join date : 2012-11-18
Age : 27
Location : music is better than popping pills

Back to top Go down

baby's first program Empty Re: baby's first program

Post by LEADER OF THE FREE WORLD Thu Aug 01, 2013 3:35 pm

what language is that
LEADER OF THE FREE WORLD
LEADER OF THE FREE WORLD
UNSTOPPABLE

Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420

Back to top Go down

baby's first program Empty Re: baby's first program

Post by nerd crusher Thu Aug 01, 2013 3:41 pm

ozzie freedom wrote:what language is that
bash

so it's not really a program since that's just a shell
nerd crusher
nerd crusher

Posts : 749
money : 848
bitches : 8
Join date : 2013-08-01
Age : 27

Back to top Go down

baby's first program Empty Re: baby's first program

Post by Magician Thu Aug 01, 2013 3:54 pm

I have no idea what it says.
Magician
Magician
MAGGY THE MAGICIAN

Posts : 3436
money : 4166
bitches : 8
Join date : 2013-03-08
Location : Roman Catholicism
Humor : Mature humour for mature people such as myself

Back to top Go down

baby's first program Empty Re: baby's first program

Post by nerd crusher Thu Aug 01, 2013 4:00 pm

Magician wrote:I have no idea what it says.
breakdown:

export itsautomated=0 <-- "export" is a command that sets an environment variable; so in this case, the number zero (but you can make it anything you want, you could have it say "ammy is kool" but that wouldn't work in this situation)


while true; do <-- loop whatever's down there, once it reaches "done" it just repeats the line underneath until it gets to done again, and then do it over and over

export itsautomated=`expr $itsautomated + 1` <-- again sets the "itsautomated" variable, uses the program "expr" (expression) to add the number 1 to the variable

if [ $itsautomated == 100 ]; then exit; else wget https://7img.net/users/3417/17/08/55/avatars/1-$itsautomated.png; fi <-- once the number hits 100, cancel the loop and exit the program, if it's still in the range of 1-99, use the program "wget" (which downloads webpages) to download from the list of my avatars with the variable $itsautomated filling the 1-*** spot, so it would be avatars/1-1.png, avatars/1-2.png until it reaches 99

shell scripts are easy to understand when you understand what every program does


Last edited by XXXNERDKILLERXXX on Thu Aug 01, 2013 4:05 pm; edited 1 time in total
nerd crusher
nerd crusher

Posts : 749
money : 848
bitches : 8
Join date : 2013-08-01
Age : 27

Back to top Go down

baby's first program Empty Re: baby's first program

Post by LEADER OF THE FREE WORLD Thu Aug 01, 2013 4:05 pm

if you only need to do it 100 times then why not just for i<100
LEADER OF THE FREE WORLD
LEADER OF THE FREE WORLD
UNSTOPPABLE

Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420

Back to top Go down

baby's first program Empty Re: baby's first program

Post by nerd crusher Thu Aug 01, 2013 4:10 pm

ozzie freedom wrote:if you only need to do it 100 times then why not just for i<100
there isn't really a huge difference between the two depending on what you use, it's 6 in one hand and half a dozen in the other. i just went with "wait til it climbs to 100 and then kill the program" because thats what im used to
nerd crusher
nerd crusher

Posts : 749
money : 848
bitches : 8
Join date : 2013-08-01
Age : 27

Back to top Go down

baby's first program Empty Re: baby's first program

Post by ammmmy Sun Dec 22, 2013 7:43 pm

im bored tonight so i redid this and made itsautomated.sh 2nd edition

Code:
export itsautomated=0
echo "UID?"
read sub
wget http://r29.imgfast.net/users/3417/17/08/55/avatars/$sub-$itsautomated.{png,jpg}
while true; do
export itsautomated=`expr $itsautomated + 1`
if [ $itsautomated == 100 ]; then rm `du -ah | grep 4.0K | egrep -i "png|jpg" | cut -f 2` && mkdir $sub && mv `ls |egrep -i "png|jpg"` $sub && exit; else wget http://r29.imgfast.net/users/3417/17/08/55/avatars/$sub-$itsautomated.{png,jpg}; fi
done

it is glorious
ammmmy
ammmmy

Posts : 2050
money : 2180
bitches : -1
Join date : 2013-12-07
Age : 27

Back to top Go down

baby's first program Empty Re: baby's first program

Post by LEADER OF THE FREE WORLD Sun Dec 22, 2013 7:49 pm

buy a thousand raspberry pis and run millions of that script
LEADER OF THE FREE WORLD
LEADER OF THE FREE WORLD
UNSTOPPABLE

Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420

Back to top Go down

baby's first program Empty Re: baby's first program

Post by ammmmy Sun Dec 22, 2013 7:52 pm

seth wrote:buy a thousand raspberry pis and run millions of that script
it has user input at the start i dont want to burn my fingers off
ammmmy
ammmmy

Posts : 2050
money : 2180
bitches : -1
Join date : 2013-12-07
Age : 27

Back to top Go down

baby's first program Empty Re: baby's first program

Post by LEADER OF THE FREE WORLD Sun Dec 22, 2013 7:56 pm

make robotic hands
LEADER OF THE FREE WORLD
LEADER OF THE FREE WORLD
UNSTOPPABLE

Posts : 21233
money : 2147483634
bitches : -828
Join date : 2013-02-25
Age : 14
Location : worlds most dangerous hacker
Humor : bench 420 squat 420 deadlift 420

Back to top Go down

baby's first program Empty Re: baby's first program

Post by ammmmy Sun Dec 22, 2013 9:47 pm

stupid fucking thing breaks if you already have a directory
ammmmy
ammmmy

Posts : 2050
money : 2180
bitches : -1
Join date : 2013-12-07
Age : 27

Back to top Go down

baby's first program Empty Re: baby's first program

Post by ammmmy Mon Dec 23, 2013 4:54 am

this opens up some possibilities for RTCity-tier statician bullshit

for example, running `md5sum * | cut -d" " -f 1 |sort | uniq -dc | sort` can show you what avatar is most commonly uploaded (although you cant see the filename)
ammmmy
ammmmy

Posts : 2050
money : 2180
bitches : -1
Join date : 2013-12-07
Age : 27

Back to top Go down

baby's first program Empty Re: baby's first program

Post by ammmmy Mon Dec 23, 2013 5:15 am

ammmmy wrote:this opens up some possibilities for RTCity-tier statician bullshit

for example, running `md5sum * | cut -d" " -f 1 |sort | uniq -dc | sort` can show you what avatar is most commonly uploaded (although you cant see the filename)
recursive avatar sorting

md5sum `find . -type f` | cut -d" " -f 1 | sort | uniq -c | sort
ammmmy
ammmmy

Posts : 2050
money : 2180
bitches : -1
Join date : 2013-12-07
Age : 27

Back to top Go down

baby's first program Empty Re: baby's first program

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum