Mess with DNS
Jan. 3rd, 2022 05:55 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) brainwane
brainwaneJulia Evans has built a site to help you play with DNS without messing up stuff in your life that needs to work.
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) brainwane
brainwane![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) foxfirefey
foxfirefeyWP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) jadelennox
jadelennoxfind 
     base command, doesn't change
. 
     the top directory you're seeking in.  Could put a relative or absolute path here.
-type f 
     Narrowing down the kind of files you're seeking, in this case to regular files. 
     You could narrow it down in other ways, e.g. -name "*.c"
-exec egrep -H "string I'm seeking" {} \;
     the grep command in question. 
     The only thing I have a very here is the egrep switch (and the string).
     -H lists filename and the match
     -l just lists the filename; less informative but cleaner.
     {} \; is necessary syntax for the exec argument to find.![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) jadelennox
jadelennox![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) shadowspar
shadowsparReferences 1. http://example.org/lolcats-page-2/ 2. http://example.org/lolcats/lolcat-101.gif 3. http://example.org/lolcats/lolcat-102.gif
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) foxfirefey
foxfirefey![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) themalkolm:
themalkolm:The best ping story I've ever heard was told to me at a USENIX conference, where a network administrator with an intermittent Ethernet had linked the ping program to his vocoder program, in essence writing:ping goodhost | sed -e 's/.*/ping/' | vocoder
He wired the vocoder's output into his office stereo and turned up the volume as loud as he could stand. The computer sat there shouting "Ping, ping, ping..." once a second, and he wandered through the building wiggling Ethernet connectors until the sound stopped. And that's how he found the intermittent failure.
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) tonybaldwin
tonybaldwin#!/bin/bash
# update friendica with bash, vim and curl
# I put this in my path as "friendi.sh"
# by tony baldwn, http://tonybaldwin.me
# on friendica at http://free-haven.org/profile/tony
# released according to the Gnu Public License, v.3
# first, create a post/update
filedate=$(date +%m%d%y%H%M%S)
# if you did not enter text for update, the script asks for it
if [[ $(echo $*) ]]; then
	ud="$*"
else
	vim $filedate.fpost
	ud=$(cat $filedate.fpost)
fi
# now to see if you want to crosspost elsewhere
echo "For the following question regarding crossposting, please enter the number 1 for yes, and 0 for no."
echo "If your friendica has the plugins, and you've configured them, you can crosspost to other blogs and sites."
echo "friendica will even automatically change the bbcode to proper html for you."
echo "would you like to crosspost to "
read -p "statusnet? " snet
read -p "twitter? " twit
read -p "facebook? " fb
read -p "dreamwidth?  " dw
read -p "livejournal? " lj
read -p "tumblr? " tum
read -p "posterous? " pos
read -p "wordpress? " wp 
# now to authenticate
read -p "Please enter your username: " uname
read -p "Please enter your password: " pwrd
read -p "Enter the domain of your Friendica site (i.e. http://friendica.somesite.net, without trailing /): " url
# and this is the curl command that sends the update to the server
if [[ $(curl -u $uname:$pwrd  -d "status=$ud&ljpost_enable=$lj&posterous_enable=$pos&dwpost_enable=$dw&wppost_enable=$wp&tumblr_enable=$tum&facebook_enable=$fb&twitter_enable=$twit&statusnet_enable=$snet&source=friendi.sh"  $url/api/statuses/update.xml | grep error) ]]; then
# what does the server say?
	echo "Error"
else 
	echo "Success!"
	echo $ud
fi
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) sophie
sophiegrep command into IRC or IM, and don't want each match on a separate line. Fortunately, it's easy to convert it to a comma-separated list instead - simply pipe the output through xargs echo | sed 's/ /, /g'. So, for example, instead of:Sophie@Sophie-Laptop:~/primtionary$ grep cuddle american-english-insane
cuddle
cuddleable
cuddled
cuddler
cuddlers
cuddles
cuddlesome
scuddle
scuddled
scuddles
upscuddleSophie@Sophie-Laptop:~/primtionary$ grep cuddle american-english-insane | xargs echo | sed 's/ /, /g'
cuddle, cuddleable, cuddled, cuddler, cuddlers, cuddles, cuddlesome, scuddle, scuddled, scuddles, upscuddle![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) sophie
sophiesort and then piping the output of that through uniq, you can just use sort -u, which will do both operations at once.sort | uniq -c | sort -n to sort by the number of times a line appears, but it's still a nice tip. :)![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) foxfirefey
foxfirefey![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) foxfirefey
foxfirefey![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) shadowspar's just made a great post about using diagraphs in vim...and making <3 into one of them!
shadowspar's just made a great post about using diagraphs in vim...and making <3 into one of them!![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) tara_hanoi
tara_hanoi
tara_hanoi@tara_babel:/export/home/sketchy$ wget --max-redirect=0 http://t.co/8xED8dz
--2011-07-25 16:01:10--  http://t.co/8xED8dz
Resolving t.co... 199.59.148.12
Connecting to t.co|199.59.148.12|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://bit.ly/guxtdh [following]
0 redirections exceeded.
tara_hanoi@tara_babel:/export/home/sketchy$ wget --max-redirect=1 http://t.co/8xED8dz
--2011-07-25 16:03:50--  http://t.co/8xED8dz
Resolving t.co... 199.59.148.12
Connecting to t.co|199.59.148.12|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://bit.ly/guxtdh [following]
--2011-07-25 16:03:51--  http://bit.ly/guxtdh
Resolving bit.ly... 168.143.172.53, 2001:418:e801::12:1, 2001:418:e801::15:1, ...
Connecting to bit.ly|168.143.172.53|:80... connected.
HTTP request sent, awaiting response... 301 Moved
Location: http://tara-hanoi.dreamwidth.org/1508.html [following]
1 redirections exceeded.
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) chebe
chebesed -i 's/\r//' $file_nameperl -pi -e 's/\r\n/\n/g' $file_name![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) pixel
pixel![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) brownbetty
brownbetty![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) sophie
sophiecommand 1 | command2command2 doesn't allow reading from standard input, and only supports filenames? How can you do this without writing to a file?<(command) syntax. For example, the above command can be written:command2 <(command1)command1 in a subshell, and at the same time, call command2 with a file descriptor looking something like /dev/fd/63. When command2 reads from that, it'll get the output of command1.diff -u <(sort filea.txt) <(sort fileb.txt)rev <(echo wheeness; sleep 2; echo blarg)![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) sophie
sophiexargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 optionls: cannot access /home/sophie/directory: No such file or directory
ls: cannot access with: No such file or directory
ls: cannot access spaces: No such file or directory
ls: cannot access in/blah.txt: No such file or directory-d"\n" switch before the command you want xargs to execute. This tells xargs that you don't want xargs to mess with your input at all except to treat newline characters as delimiters. This time, you should find that both apostrophes and spaces are accepted properly.![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) brainwane - Mess with DNS
brainwane - Mess with DNS![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) foxfirefey - Getting things from the web using the command line
foxfirefey - Getting things from the web using the command line![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) foxfirefey - WP-CLI: Because you'd prefer to manage WordPress on the command line
foxfirefey - WP-CLI: Because you'd prefer to manage WordPress on the command line![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) jadelennox - finding a string in a directory
jadelennox - finding a string in a directory![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) jadelennox - curly braces on the shell
jadelennox - curly braces on the shell![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) shadowspar - seeeeeeeeeeeeed
shadowspar - seeeeeeeeeeeeed![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) foxfirefey - howdoi: do your code how-to searches from the command line
foxfirefey - howdoi: do your code how-to searches from the command line![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) foxfirefey - A Ping Story
foxfirefey - A Ping Story![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) foxfirefey - Happy Halloween!
foxfirefey - Happy Halloween!![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) tonybaldwin - Post to Friendica with bash, curl and vim
tonybaldwin - Post to Friendica with bash, curl and vim![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) sophie - Generating a comma-separated list from grep
sophie - Generating a comma-separated list from grep![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) sophie - sort and uniq
sophie - sort and uniq![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) foxfirefey - Bad command line habits and good ones to replace them
foxfirefey - Bad command line habits and good ones to replace them![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) foxfirefey - vim diagraphs
foxfirefey - vim diagraphs![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) tara_hanoi - Expanding shortened URLs with wget
tara_hanoi - Expanding shortened URLs with wget![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) chebe - Removing Windows carriage-returns from text files
chebe - Removing Windows carriage-returns from text files![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) pixel - UbuntuOne & dotfiles (Or, home is where the dotfiles are...)
pixel - UbuntuOne & dotfiles (Or, home is where the dotfiles are...)![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) brownbetty - Text editor recs?
brownbetty - Text editor recs?![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) sophie - An alternative to the pipe (in bash/ksh)
sophie - An alternative to the pipe (in bash/ksh)![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png) sophie - xargs and apostrophes/spaces
sophie - xargs and apostrophes/spaces