This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY = count | |
MAKEFILES = $(wildcard *.mk) | |
count: ;@echo $(MAKEFILES) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY = count | |
MD = $(wildcard *.md) | |
HTML = $(MD:.md=.html) | |
count: ;@echo $(HTML) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY = count | |
HTML = $(patsubst %.md,%.html,$(wildcard *.md)) | |
count: ;@echo $(HTML) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTML = $(patsubst %.md,%.html,$(wildcard *.md)) | |
all: $(HTML) | |
$(HTML): %.html: %.md | |
pandoc $< -o $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTML = $(patsubst %.md,%.html,$(wildcard *.md)) | |
all: $(HTML) | |
$(HTML): %.html: %.md | |
ifneq ($(shell command -v pandoc 2> /dev/null),) | |
pandoc $< -o $@ | |
else | |
ifneq ($(shell command -v markdown-html 2> /dev/null),) | |
markdown-html $< -o $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print(list(filter( lambda pow2: pow2^(pow2-1) > pow2, range(1000)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get the list of PIDs and cpu use, sort numerically using the second column or key, take the last one, and extract the second column | |
ps —no-headers -eo pid,%cpu | sort -k2 -n | tail -1 | cut -d ' ' -f 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get the list of PIDs and cpu usage via the batch version of top if ps is not fully functional, take out the headers, sort numerically using the 9th column, which is the CPU usage as key, take the last one, and extract the second column | |
top -n 1 -b | tail -n +8 | sort -k9 -n | tail -1 | cut -d ' ' -f 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tip de https://t.co/tQKo7Err73 para "aplanar" una lista de listas | |
sum(list(map( lambda n: [str(n)+'♠',str(n)+'♣',str(n)+'♥',str(n)+'♦'], ['A','J','Q','K',2,3,4,5,6,7,8,9,10])),[]) | |
# El map genera una lista de listas, y sum agrega las listas del segundo nivel en una sola, usando la sobrecarga de + para listas |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use JSON::Tiny; | |
sub MAIN( Str $letter-to-santa = 'letters/dear-santa.txt' ) { | |
say to-json $letter-to-santa.IO.slurp().split(/\s* «and» \s*/); | |
} |