baby's first program
5 posters
Page 1 of 1
baby's first program
im making a little script to automagically download all of my avatars on forumotion
look at this quality shit:
tabs are for pussies
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- 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
Re: baby's first program
it works perfectly though
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
Re: baby's first program
what language is that
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
Re: baby's first program
bashozzie freedom wrote:what language is that
so it's not really a program since that's just a shell
nerd crusher- Posts : 749
money : 848
bitches : 8
Join date : 2013-08-01
Age : 27
Re: baby's first program
I have no idea what it says.
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
Re: baby's first program
breakdown:Magician wrote:I have no idea what it says.
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- Posts : 749
money : 848
bitches : 8
Join date : 2013-08-01
Age : 27
Re: baby's first program
if you only need to do it 100 times then why not just for i<100
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
Re: baby's first program
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 toozzie freedom wrote:if you only need to do it 100 times then why not just for i<100
nerd crusher- Posts : 749
money : 848
bitches : 8
Join date : 2013-08-01
Age : 27
Re: baby's first program
im bored tonight so i redid this and made itsautomated.sh 2nd edition
it is glorious
- 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- Posts : 2050
money : 2180
bitches : -1
Join date : 2013-12-07
Age : 27
Re: baby's first program
buy a thousand raspberry pis and run millions of that script
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
Re: baby's first program
it has user input at the start i dont want to burn my fingers offseth wrote:buy a thousand raspberry pis and run millions of that script
ammmmy- Posts : 2050
money : 2180
bitches : -1
Join date : 2013-12-07
Age : 27
Re: baby's first program
make robotic hands
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
Re: baby's first program
stupid fucking thing breaks if you already have a directory
ammmmy- Posts : 2050
money : 2180
bitches : -1
Join date : 2013-12-07
Age : 27
Re: baby's first program
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)
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- Posts : 2050
money : 2180
bitches : -1
Join date : 2013-12-07
Age : 27
Re: baby's first program
recursive avatar sortingammmmy 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)
md5sum `find . -type f` | cut -d" " -f 1 | sort | uniq -c | sort
ammmmy- Posts : 2050
money : 2180
bitches : -1
Join date : 2013-12-07
Age : 27
Similar topics
» skype is actually a pretty gay program
» you shiould never use a program that doesn't have its source code freely available
» this program is pretty damn cool
» quality program design general
» whats the shittiest program youve ever used ottd
» you shiould never use a program that doesn't have its source code freely available
» this program is pretty damn cool
» quality program design general
» whats the shittiest program youve ever used ottd
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|