NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
karim enterprises Terms of Service and Privacy Policy | |
1. Terms | |
By using the Karim chatbot, you are agreeing to be bound by these terms of service, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local laws. If you do not agree with any of these terms, you are prohibited from using or accessing this site. The materials contained in this website are protected by applicable copyright and trademark law. | |
2. Use License | |
#!/bin/bash | |
which $1 >/dev/null 2>&1; if [ $? -eq 0 ] | |
then | |
echo "$1 is installed." | |
else | |
echo "$1 is not installed." >&2 | |
echo | |
echo "Do you wish to install it?" | |
select yn in "Yes" "No"; do |
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
<template> | |
<div> | |
<h1> {{ message }} </h1> | |
<div | |
</template> | |
<script> | |
export default { | |
/* Child component registration */ | |
components: {}, | |
// App.svelte | |
<script> | |
export let area = 51; | |
</script> | |
<main> | |
<p>{area}</p> | |
</main> | |
// main.js | |
import './main.pcss'; |
import datetime | |
from datetime import timedelta | |
now = datetime.datetime.now() | |
delta = timedelta( | |
days=0, | |
seconds=1000000000, | |
microseconds=0, | |
milliseconds=0, | |
minutes=0, | |
hours=0, |
import time | |
starttime = time.time() | |
lasttime = starttime | |
lapnum = 1 | |
value = "" | |
print("Press ENTER for each lap.\nType Q and press ENTER to stop.") | |
while value.lower() != "q": | |
# Recursively search for any number of patterns in whole files with a specified file extension and with any number of patterns. | |
# Print matching files filenames and contents (squashed to one line) | |
cat <(for i in $(grep -rl PATTERN1 --include="*.*" /path/to/search); do echo $i && cat $i|xargs 2>/dev/null ; done)|awk '/PATTERN2/ && /PATTERN3/ {n = 2} n {print prev; n--} {prev = $0} END {if (n) print}' | |
# Look only for matches on a single line | |
for i in $(grep -rl PATTERN1 --include="*.*" /path/to/search); do echo $i && cat $i | awk '/PATTERN2/ && /PATTERN3/' ; done | |
for i in $(find "/some/path" -type f -name "*"); do echo $i && cat $i | awk '/PATTERN1/ && /PATTERN2/ && /PATTERN3/' ; done | |
# For long lists of files so we can step through | |
cat <(for i in $(grep -rl PATTERN1 --include="*.*" /path); do echo $i && cat $i | awk '/PATTERN1/ && /PATTERN2/ && /PATTERN3/' ; done)|less | |
cat <(for i in $(find "/some/path" -type f -name "*"); do echo $i && cat $i | awk '/PATTERN1/ && /PATTERN2/ && /PATTERN3/' ; done)|less |