Skip to content

Instantly share code, notes, and snippets.

@jiahut
Last active June 25, 2019 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiahut/9474675b3611abea6c1a2b0fa40e5fda to your computer and use it in GitHub Desktop.
Save jiahut/9474675b3611abea6c1a2b0fa40e5fda to your computer and use it in GitHub Desktop.

regex

https://rubular.com/ https://stackoverflow.com/questions/6673847/what-are-rubys-numbered-global-variables https://www.jianshu.com/p/974dee8953e6

$` and $' : before $& after match

cat <<- EOF | ruby -ne ' puts $& if $_ =~ /

.*?</div>/ ' a1
test1
b1
test2
c1 a2
test1
b2
test2
c2 a3
test1
b3
test2
c3 EOF

BEGIN and END block

https://stackoverflow.com/questions/14050296/what-does-rubys-begin-do

curl -Lk https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best_ip.txt | ruby -ne 'BEGIN { $O = [] }; $O << $_ if $_ =~ /\S+/ ; END { print $O.map { |it| it.strip() }.join(",") } ' > /tmp/trackers_best_ip.txt.list

dpkg reconfig

https://askubuntu.com/questions/603493/apt-get-dependency-issue-open-ssh-client

dpkg --purge openssh-server apt install openssh-server -y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment