Minecraft 1.17.1 How to Summon a Falling Block: (piston[extended=true])? - minecraft

I tried the following command:
summon falling_block ~ ~ ~ {BlockState:{Name:"minecraft:piston",Properties:{extended:true}},Time:-1000,NoGravity:1b}
but it wasn't the type of piston that I want to summon.
Here is what I am looking for

You have to use "true" instead of true
This is the command to do it:
summon falling_block ~ ~ ~ {BlockState:{Name:"minecraft:piston",Properties:{extended:"true"}},Time:-1000,NoGravity:1b}
(tested in 1.17, find by Ofek)

Related

extract multiple strings with regex

I have the following text:
Disable Automounting /usr/bin/systemctl is-enabled autofs | /usr/bin/awk '{print} END {if(NR==0) print "disabled" }'
Ensure nodev option set on /home partition for i in /etc/fstab; do /bin/echo '==========' `/bin/ls -la $i`; /bin/cat $i; done
I would like to get the cmd line in both line, by matching :
what is between / and }' -> usr/bin/systemctl is-enabled autofs | /usr/bin/awk '{print} END {if(NR==0) print "disabled"
OR what is between for and done -> i in /etc/fstab; do /bin/echo '==========' /bin/ls -la $i; /bin/cat $i;
I managed to do it with one matching group : for(.*)done
I can't with both though.
Thanks
You can easily achieve what you want using the lookahead and lookbehind features of PCRE and since GNU grep supports PCRE (while sed and awk do not), you can use the following:
#!/bin/sh
grep -Po "(?<=\/)(.*?)(?= }')|(?<=for )(.*?)(?= done)" <<-'EOF'
Disable Automounting /usr/bin/systemctl is-enabled autofs | /usr/bin/awk '{print} END {if(NR==0) print "disabled" }'
Ensure nodev option set on /home partition for i in /etc/fstab; do /bin/echo '==========' `/bin/ls -la $i`; /bin/cat $i; done
EOF
(?<=\/)(.*?)(?= }') matches what's between / and }' while (?<=for )(.*?)(?= done) matches what's between for and done. | between the two expressions is just the PCRE OR operator.

awk: runtime error - Compatility between zsh config on MacOS Catalina and zsh config on Debian Buster

I have a zsh config on MacOS Catalina which works well. No, I would like to get the same but for Debian 10 Buster.
The issue occurs in the using of function for PROMPT that displays pink slashes that separate the PATH current working where directories are in blue.
On MacOS, I do it like this (into my .zshrc) :
# Path with colorized forward slash
slash_color() {
dirs | awk -F "/" '{ blue="%{\033[38;5;75m%}"; \
pink="%{\033[38;5;206m%}"; \
for (i=1; i<NF; i++) \
printf blue $i pink "/"; \
printf blue $NF pink; \
}';
}
# Prompt final
PROMPT=$'%F{13}|%F{green}%n#%F{cyan}%m%F{13}|%f%T%F{13}|$(slash_color)%F{13}|%F{7} '
The result looks like for PROMPT :
Now, on Debian Buster, I have copied the ~/.zshrc from MacOS Catalina.
and when PROMPT is displayed, the PATH of current working directory is not displayed (empty) and I get the following error :
awk: run time error: not enough arguments passed to printf("%{%}~%{%}/")
FILENAME="-" FNR=1 NR=1
I don't know why I have this error on Debian and not on MacOS. I suspect this is due to a difference on the working of my slash_color() function but I don't understand the origin.
It seems that a variable is missing in Debian version for awk, but I can't see which one.
Do not do: printf something. Always do printf "%s", something. The awk errors, because you passed invalid printf format specifiers %{ and %}, yet you did not pass any arguments. Do:
printf "%s%s%s/", blue, $i, pink;
I think you can just:
{gsub("/", pink "/" blue)}1
I would use a pre-command hook and simple parameter expansion instead of forking various external programs.
precmd () {
bar='%F{13}|'
prompt="$bar%F{green}%n#%F{cyan}%m$bar%f%T$bar%F{75}"
prompt+=${PWD:gs./.%F{206}/%F{75}}
prompt+="$bar%F{7} "
}
Add this to your .zshrc file, and prompt will be reset prior to displaying it, rather than embedding a shell function in the prompt itself.
PWD is the current working directory. The gs.---.--- expansion modifier replaces each / with %F{206}/%F{75}, using zsh's own color escape sequences rather than using raw ANSI escape sequences.

How to insert argument in awk script?

I'm writing a shell script which shut down some services and trying to get its pid by using the following awk script.
However, this awk script can't get pid. What's wrong with that?
ps -ef | awk -v port_no=10080 '/[m]ilk.*port=port_no/{print $2}'
The result of ps -ef is like this:
username 13155 27705 0 16:06 pts/2 00:00:00 /home/username/.rbenv/versions/2.3.6/bin/ruby /home/username/.rbenv/versions/2.3.6/bin/milk web --no-browser --host=example.com --port=10080
This process is working with a different port argument as well, so I want to kill the process only working on port=10080.
The awk script below works fine, but when I specify the port no using awk -v like the above, it doesn't work well.
ps -ef | awk '/[m]ilk.*port=10080/{print $2}'
awk version: GNU Awk 4.0.2
The syntax for pattern matching with /../ does not work with variables in the regular expression. You need to use the ~ syntax for it.
awk -v port_no=10080 '$0 ~ "[m]ilk.*port="port_no{print $2}'
If you notice the regex carefully, the regex string on the r.h.s of ~ is under the double-quotes ".." except the variable name holding the port number which shouldn't be under quotes, for the expansion to happen.
This task is easily accomplished using pgrep:
$ pgrep -f '[m]ilk.*port=10080'
Have a look at man pgrep for details.

pass shell variable into awk's patern search

In a script I want to search connections established between some ports gathered with another command and set on PORT variable and specific systems.
the PORT variable is pass to awk using -vp=${PORT}
but I don't know how to use "p" it inside the rest of the pattern.
his does not work:
$ lsof -i -P|awk -vp=${PORT} '$(NF-1)~/vm7.+:'$p'->(vm9|vm11).+ESTABLISHED/{print $(NF-1)}'
$ lsof -i -P|awk -vp=${PORT} '$(NF-1)~/vm7.+:'p'->(vm9|vm11).+ESTABLISHED/{print $(NF-1)}'
give this a try:
awk -v p="$PORT" '{pat="yourHost(or whatever):"p}$(NF-1)~pat{print $(NF-1)}'
build the pattern(pat) with p and check the field (NF-1)
you don't need (shouldn't have) the ESTABLISHED in pattern, since it is the last field NF instead of NF-1
Use match:
$ awk -v p=$port 'match($(NF-1),"vm7.+:" p "->(vm9|vm11)"){print $(NF-1)}'
There might be some errors as there was no test material. Removed the ESTABLISHED as it is in $NF, not $(NF-1) (in my systems, at least).
... or don't:
$ awk -v p=$port '$(NF-1) ~ "vm7.+:" p "->(vm9|vm11)" {print $(NF-1)}'
Today I learned something.

Behat tests not running on CircleCI

I'm having come trouble getting my tests to run within CircleCI. Locally the tests run fine, as shown on the right side of the screenshot. But in CircleCI, it will load the SuiteContext file and run the Before/AfterSuite methods, but nothing else. What would cause this sort of behavior? Thanks
default:
autoload: Test/Context
suites:
default:
paths:
features: Test/Features
contexts:
- SettingContext: ~
- LanguageContext: ~
- ActionContext: ~
- FrontendContext: ~
- FileTypeContext: ~
- FieldContext: ~
- ChannelContext: ~
- BrowserContext: ~
- SuiteContext: ~
- RequestContext: ~
- UrlContext: ~
- TemplateContext: ~
- PhraseContext: ~
- CategoryContext: ~
- EntryContext: ~
extensions:
Behat\MinkExtension:
base_url: http://ee300-clean.dev
selenium2: ~
Paths to files in Circle instance:
/home
/ubuntu
/project
/app
/bin
/behat
/behat.yml
/Test
/Context
/Features
circle.yml
test:
override:
- cd /home/ubuntu/project/app && bin/behat
I've changed that override command several times to explicitly set the path to the Features directory, but nothing I've tried works.
This ended up being a case sensitivity issue. Long ago I had renamed my features folder to Features, and locally on my Mac it still appeared as Features, however, it was committed to Git as features. Mac seemed to be more forgiving and still ran the tests even though the config file had "Features" in it, but Ubuntu server on Circle wasn't as forgiving.