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
#usage: script gist_user ... <gist_hash|gist_filename> <gist_hash|gist_filename> | |
#example: wget -q -O - https://goo.gl/jVJuEc |bash -s rubeniskov concat-bash-sources.mk | |
#example Makefile includes | |
#INCLUDE_MODULES = concat-bash-sources.mk \ | |
# build_benchmark.mk \ | |
# crawler.mk \ | |
# publish_gist.mk | |
# | |
#include $(shell wget -q -O - goo.gl/jVJuEc |bash -s rubeniskov $(INCLUDE_MODULES)) |
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
# $(call concat_bash_sources,<main.sh>[,header,footer]) | |
define concat_bash_sources | |
echo "$(1)" |\ | |
awk -v header="$(2)" \ | |
-v footer="$(3)" \ | |
-f <(wget -q -O - https://gist.githubusercontent.com/rubeniskov/b039a9a37827421e7eb3981a29d36c01/raw) | |
endef |
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
#!/usr/bin/env awk | |
# usage | |
# echo "main.sh" | awk -v header='# HEADER COMMENT' -v footer='# FOOTER COMMENT' -f concat-bash-sources.awk | |
function read_file_content(file) { | |
while ((getline line < file) > 0) { | |
if ( line ~ /^source / ) { | |
print parse_bash_source(line) | |
# remove comments and hashbangs | |
} else if ( line !~ /^#/ ) { |
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
# $(call build_benchmark,<source>) | |
define build_benchmark | |
timestamp=$$(date +%s) && \ | |
$(1) \ | |
&& printf >&2 "Build took %d seconds\n" $$(($$(date +%s)-timestamp)) | |
endef |
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
# $(call crawler,<url>,<depth_levels>) | |
define crawler | |
{ echo '$(1)'\ | |
$(foreach DEPTH_LEVEL, $(shell printf '1 %.0s' {1..$(2)}), \ | |
| xargs -n 1 -P $(shell echo $$(($$(nproc 2>/dev/null|| sysctl -n hw.physicalcpu) * 32))) \ | |
wget \ | |
--delete-after \ | |
--level=$(DEPTH_LEVEL) \ | |
--domains="$(shell echo '$(1)'|awk -F/ '{print $$3}')" \ |
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
# $(call publish_gist,<access_token>,<filename>,<description>[,gist_hash]) | |
define publish_gist | |
cat $(2) |\ | |
awk -v description="$(3)" \ | |
-v filename="$(2)" \ | |
'BEGIN {\ | |
ORS = "";\ | |
print("{");\ | |
printf("\"description\": \"%s\",",description);\ |
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
#!/usr/bin/env bash | |
VERSION="" | |
LTU_VERSION=${VERSION:="TESTING"} | |
LTU_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
LTU_PATH=${LTU_PATH:="$LTU_DIR"} | |
LTU_DEST_DIR=${LTU_DEST_DIR:="$LTU_PATH/toolchains"} | |
LTU_CACHE_DIR=${LTU_CACHE_DIR:="$LTU_PATH/cache"} |
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
http://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-elf/gcc-linaro-4.9-2016.02-i686-mingw32_aarch64-elf.tar.xz | |
http://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-elf/gcc-linaro-4.9-2016.02-i686-mingw32_aarch64-elf.tar.xz | |
http://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-elf/gcc-linaro-4.9-2016.02-x86_64_aarch64-elf.tar.xz | |
http://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-elf/gcc-linaro-4.9-2016.02-x86_64_aarch64-elf.tar.xz | |
http://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-elf/gcc-linaro-4.9-2016.02.tar.xz | |
http://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-elf/gcc-linaro-4.9-2016.02.tar.xz | |
http://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-linux-gnu/gcc-linaro-4.9-2016.02-i686-mingw32_aarch64-linux-gnu.tar.xz | |
http://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-linux-gnu/gcc-linaro-4.9-2016.02-i686-mingw32 |
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
curl https://goo.gl/g8PnUL -L -o bbb_sunflower.mp4 --progress-bar 2>&1 | | |
while IFS= read -d $'\r' -r p; do | |
p=${p:(-6)} | |
p=${p%'%'*} | |
p=${p/,/} | |
p=$(expr $p / 10 2>/dev/null); | |
echo -ne "[ $p% ] [ $(eval 'printf =%.0s {1..'${p}'}')> ]\r" | |
done | |
# TODO |
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
#!/bin/awk | |
function max(a, b){ | |
return (a > b) ? a : b | |
} | |
function draw_splitter(column_sizes){ | |
for(i = 1; i <= length(column_sizes); i++) { | |
str_splitter=sprintf("%"column_sizes[i]"s", ""); | |
gsub(/ /, "-", str_splitter); |