Strip HTML tags from a string. Does not use (much) regex.
Never loads any resources (<img>
, <script>
, etc.) referenced in the input.
The treatment of whitespace is probably consistent across browsers but is not guaranteed.
Technique
#!/bin/bash | |
# Call like you would `diff` | |
# `./diff-changed-lines.sh old new` | |
# Outputs the lines numbers of the new file | |
# that are not present in the old file. | |
# That is, outputs line numbers for new lines and changed lines | |
# and does not output line numbers deleted or unchanged lines. |
# I was targeting a machine using this version of Debian. Hopefully, you're targeting something newer. | |
docker run --rm -it debian:stretch bash | |
# This version of Debian is old enough that the package list has been moved to the archives. | |
# You may not need to do this. | |
# Note: if you're using a backports distribution, you'll need to do the same for /etc/apt/sources.list.d/* | |
sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list | |
apt update # Some errors. Seems fine? | |
# aptitude is easier to use if there are problems/conflicts. |
#!/bin/bash | |
# Approximates the phase of the moon using a known new-moon time and a fixed lunar phase of 2551443 seconds. | |
# Outputs the phase as an emoji in UTF-8 | |
CHARS=( | |
"\xf0\x9f\x8c\x91" # 0 - NEW | |
"\xf0\x9f\x8c\x91" # 1 - NEW | |
"\xf0\x9f\x8c\x92" # 2 - WAXING CRESCENT |
config.json | |
.credentials | |
node_modules |
#!/usr/bin/env python | |
import socket | |
import threading | |
import select | |
import SocketServer | |
class TCPServer( SocketServer.TCPServer ): | |
allow_reuse_address = True |
#!/bin/bash | |
ENTER=$(printf "%b" "\n") | |
ESCAPE=$(printf "%b" "\e") | |
UP_SUFFIX="A" | |
DOWN_SUFFIX="B" | |
RIGHT_SUFFIX="C" | |
LEFT_SUFFIX="D" | |
while true; do |
#!/bin/bash | |
uparrow=$'\x1b[A' | |
downarrow=$'\x1b[B' | |
leftarrow=$'\x1b[D' | |
rightarrow=$'\x1b[C' | |
read -s -n3 -p "Hit an arrow key: " x | |
case "$x" in |
#!/bin/bash | |
function usage { | |
echo "$0 [-n NUMBER] [YEAR]" | |
} | |
date -j &> /dev/null | |
if [ $? -eq 0 ]; then | |
# OS X | |
function mardigras { |