Is it possible to parse HTML with Regex?

You cannot parse [X]HTML by using Regex. Because the HTML language cannot be parsed by Regex. Regex is not a tool that can be used to parse HTML correctly. As I replied in HTML and regex questions here so many times before, using Regex will not allow you to consume HTML. Regular expressions are a poorly developed tool for understanding the constructions used by HTML. HTML is not a normal language and cannot be parsed by regular expressions. Regex queries are not equipped to divide the HTML code into its significant parts. So often, but it's not always for me. Even the irregular extended regular expressions used by Perl are not the task of HTML parsing. You're never going to let me crack. HTML is a language with sufficient complexity that cannot be parsed by regular expressions. Even Jon Pigeon cannot parse the HTML with regular expressions. Every time you try to parse the HTML code with regular expressions, the child cries the blood of the virgins, and the Russian pirates have their webapp. Parsing HTML with Regex gets the corrupted soul in the Kingdom of the living. HTML and Regex go together like love, marriage and killing of ritual children. The <center> cannot hold, it's too late. The power of Regex and HTML together in the same conceptual space will destroy your mind, like so many putty water. If you analyze the HTML code with Regex, give it to you and your blasphemous possibilities, that all of us to inhuman problems for those whose name cannot be expressed in the basic multilingual plan, it is. HTML Plus-RegExp You melt the erves of the while you observe your psyche in the onslaught of terror. Rege̿̔̉X-based HTML parser are cancer that kills StackOverflow is too late, it is too late, we can not be saved the trangession of a guaranteed Chi͡LD Regex will consume all living tissues (except HTML,) that can not, as already prophesied, dear Sir, help us, how can anyone survive this plague with HTML regex analysis, mankind has become an eternity of torture and dreadlocks with regex as a tool for HTML processing becomes a pause between this world and the frightening realm of entities C͒ͪo͛ͫrrupt (as the SGML entities, but more corrupted) a simple glimpse of the world of the ex reg parser for HTML goes to the auntyly carrying a programmer consciousness in a world of endless cries, it is, the stench Alacridi infection Regex Wil L devour the HT-ML parser, the application and the existence of all the time that Visual Basic gets only worse does not come with it com̡e̶s , ̕h̵i s un̨ho͞ly radiańcé destro҉Ying all ENLI̍̈́̂̈́ghtenment, tags HTML Lea͠Ki̧n͘g FR̶ǫm ̡yo ͟ur Eye͢s̸u ̛l̕IK͏e FL UID Pain, the song of Re̸gular exp resion analysis will fire nguish the voices of the man Mor Tal of the SP here can see that he can see you ̲͚̖͔̙î̩́t̲͎̩̱͔́̋̀ is quite t he finally turn off the man lies everything is LOŚ͖̩͇̗̪̏̈́T all that I lost the pon̷y it is , you C̶̮OMES it is I or penetrates all my face my face or H god no no noo̼O or Nato stop A * ̶͑̾̾ ̅ͫ͏̙̤g͇̫͛͆̾ͫ̑͆l͖͉̗̩̳̟̍ͫͥͨe̠̅s ͎a̧͈͖r̽̾̈́͒͑e n ot rè̑ͧ̌aͨl̘̝̙̃ͤ͂̾̆ za̡͊͠͝LGΌ isͮ̂҉̯͈͕̹̘̱ to͇̹̺ͅɲ̴ȳ̳ TH̘Ë͖́̉a ͠P̯͍̭O̚ N̐Y̡ H̸̡̪̯ͨ͊̽̅̾̎ȩ̬̩̾͛ͪ̈́̀́͘

Have you tried using an XML parser instead? bobince

Effectively Remove all Folders

With this command you can recursively remove all node_modules folders within a path.

find . -type d -name "node_modules" -prune -exec rm -rf '{}' +

Disable SIP & Gatekeeper


csrutil status
System Integrity Protection status: enabled.

To disable the System Integrity Protection (SIP) you need to boot your Mac into Recovery Mode (CMD + R) and enter the following into the terminal.

csrutil disable
Successfully disabled System Integrity Protection. Please restart the machine for the changes to take effect.

SIP Restrictions

# Enable SIP and allow installation of unsigned kernel extensions
csrutil enable --without kext

# Enable SIP and disable filesystem protections
csrutil enable --without fs

# Enable SIP and disable debugging restrictions
csrutil enable --without debug

# Enable SIP and disable DTrace restrictions
csrutil enable --without dtrace

# Enable SIP and disable restrictions on writing to NVRAM
csrutil enable --without nvram

System Integrity Protection – Adding another layer to Apple’s security model


# Per Application:
sudo xattr -rd /Applications/

# Globally:
sudo spctl --master-disable

Letsencrypt Certificate for each Domain

Letsencrypt offers you to combine multiple domains into a single certificate or to separate them for each domain. When doing the latter you should mind the rate limits.


rsa-key-size = 4096
#server =
authenticator = webroot
webroot-path = /var/www
email = youremail@domain.tld
renew-by-default = True
agree-tos = True
certbot --config /etc/letsencrypt/cli.ini certonly -d sub.domain.tld

You can also combine a group of domains to share a single certificate.

certbot --config /etc/letsencrypt/cli.ini certonly -d domain.tld -d www.domain.tld -d sub.domain.tld


SSLCertificateFile /etc/letsencrypt/live/$servername/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/$servername/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/$servername/chain.pem

List apache vhosts


certbot --config /etc/letsencrypt/cli.ini renew

List Apache Vhosts

You can list all of your apache/httpd vhosts with this command.

# normal
httpd -S | rg '^.*(?:namevhost )([a-z\.]*)(?: \().*$' --replace '$1' | sort -u

# with counter
httpd -S | rg '^.*(?:namevhost )([a-z\.]*)(?: \().*$' --replace '$1' | sort | uniq -c

You need to install ripgrep or substitute it with sed.

Other useful httpd commands

Show all included configuration files.


Show all loaded modules.

httpd -M

Run syntax check for config files.

httpd -t
Syntax OK...

Export Man Pages

To get a plain text version of a man page, without backspaces and underscores, try:

man foo | col -bx > foo.txt

Or copy it instead.

man foo | col -bx | pbcopy

For a clipboard in Linux you might need to add:

# with xsel
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'

# or with xclip:
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'

Ability to escape HTML Characters

Put this function in your .zshrc/.bashrc/etc.


Git - Rewriting History

The Commissar Vanishes

When there are (large or unnecessary) files in your git repository that you want to remove from history you can use the follwing methods.

Typical repos shrink from about 20 MB to less than 1 MB. 1

Use git-filter-branch or install BFG.

brew install bfg

# Show sizes of files and folders
du -sh {.*,*}
# Find 10 biggest Files in Repo
git gc
git rev-list --objects --all | grep "$(

CSS nth

nth of single type

.e:nth-child(8) { ... }
.e:nth-child(n+6) { ... }
.e:nth-child(-n+9) { ... }
.e:nth-child(n+4):nth-child(-n+8) { ... }
.e:nth-child(n+2):nth-child(odd):nth-child(-n+9) { ... }
.e:nth-child(3n+1):nth-child(even) { ... }

JavaScript Key Codes

Press any key to get corresponding code:


This prints the JavaScript codes for any key on your keyboard.

You can use the code number to assign an event to the key.

window.addEventListener('keydown', funcname, false);
function funcname(e) {

  /* up */ if (e.keyCode === 38   ) { exec_if_pressed() }
  /* dn */ if (e.keyCode === 40   ) { exec_if_pressed() }
  /* $ */  if (e.keyCode === 220  ) { exec_if_pressed() }
  // etc.


How To Pass Options With Gulp

You can pass options to your gulp task via the { key0: value, key1: value, key2: value, ... } syntax.

Example for gulp-purifycss

The task gulp-purifycss uses purifycss.

.pipe(purify(['./public/app/**/*.js', './public/**/*.html']))


.pipe(purify(['./public/app/**/*.js', './public/**/*.html'], { minify: true, info: true, rejected: false }))

Example for gulp-rsync

The task gulp-rsync uses rsync.

gulp.task('deploy', function() {
  return gulp.src('build')

How To Run A Custom Ruby Gem From Any Path

You can run custom ruby gems from any path, for instance local machine, LAN or remotely, without the necessity to go over the official ruby gem index.

Specifying a :path attribute will install the gem from that path on your local machine.

gem "foreman", :path => "/Users/pje/my_foreman_fork"

Alternately, specifying a :git attribute will install the gem from a remote git repository.

gem "foreman", :git => "git://"

# ...or at a specific SHA-1 ref
gem "foreman", :git

How to log your IP Address

Have you you ever thought: "Mhmmm… was that me behind that IP address at this particular point in time? I wish I'd know that because THAT WOULD HELP ME A LOT TO DETERMINE IF I HAVE AN ISSUE HERE OR NOT!"

Bash script


ipcur=$(curl -s
if ! tail -n 1 ~/.cronjobs/iplog.csv | grep -q "$ipcur"; then
    printf '%s;' "$(date "+%Y-%m-%d;%H:%M")";
    curl -s | jq -r '.ip + ";"
    + .hostname + ";"
    + .city + ";"
    + .region + ";"
    + .country...

The Power of Opus Compression

Opus Compression

When you like to listen to a lot of Podcasts, lectures or audio books for instance, and you want to carry with you as much of it as you can then the opus audio codec is something you might be interested in. I rarely use this term but here it can be applied: The results blew my mind. It's astonishing how much audio you can pack on a mobile device with severe capacity limits.

I just converted this:

162 Files
mp3, 44100 Hz, mono, s16p, 129 kb/s
Total Length: 6d 14h 47min 49
Total Size: 9.05 GB...

MAC Address Spoofing on OS X/macOS

This can be useful when travelling.


You can put this in your .zshrc/.bashrc/etc.

spoof () {
    getmac () {
        ifconfig "$1" | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'

    macorig=$(networksetup -getmacaddress "$1" | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}')
    macprev=$(getmac "$1")
    macrand=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
    sudo /System/Library/PrivateFrameworks/Apple80211...

Execute Only If Device is Attached

Have you ever been in the situation where you needed to open an application but you only want to open this particular application if a specific device is attached? For instance, when there is a symbolic link to a huge dependent library on an external drive. Or the audio interface needs to be attached before opening the DAW.

Executing such applications without meeting these requirements can mess up your settings and you may have to manually readjust preferences, paths, do cleanups, etc. Eventually...

Rouge Syntax Highlighting

The following examples demonstrate Rouge's syntax highlighting for many different programming languages. Rouge is developed by Jeanine Adkisson. It is is a very good syntax highlighter which operates remarkably precise.

Rouge aims for the highest quality lexing in all its supported languages, even with strange features and odd corner cases.

That's right, I can confirm that rouge rather doesn't highlight at all before highlighting things wrong, which I see all the time happening with Pygments

kramdown Syntax

Source1, Source2

This is version 1.14.0 of the syntax documentation.

The kramdown syntax is based on the Markdown syntax and has been enhanced with features that are
found in other Markdown implementations like Maruku, PHP Markdown Extra and Pandoc. However,
it strives to provide a strict syntax with definite rules and therefore isn't completely compatible
with Markdown. Nonetheless, most Markdown documents should work fine when parsed with kramdown. All
places where the kramdown syntax differs from the Markdown syntax are highlighted.

Following is the complete syntax definition for all elements kramdown supports. Together with the
documentation on the available converters, it is clearly specified what you will get when a kramdown
document is converted.

Hello world - English


Once upon a midnight dreary, while I pondered, weak and weary. Over many a quaint and curious volume of forgotten lore. While I nodded, nearly napping, suddenly there came a tapping. As of some one gently rapping, rapping at my chamber door. 'Tis some visiter, I muttered, tapping at my chamber door. Only this, and nothing more. Ah, distinctly I remember it was in the bleak December. And each separate dying ember wrought its ghost upon the floor. Eagerly I wished the morrow;—vainly I had sought...