Skip to content

Instantly share code, notes, and snippets.

@l3laze
l3laze / github_latest.sh
Created June 23, 2021 02:33
Bash script to find url of latest GitHub Releases.
#!/usr/bin/env bash
github_latest () {
local usage="Usage: $(basename $0 | sed -E 's/\.sh//') [options] <owner> <repo>
Options:
-l | --like = Download release with name that contains string, e.g. amd64. *not a regex*"
local url
local dl_url
local data
@l3laze
l3laze / setup.sh
Created May 3, 2021 23:27
UserLAnd setup for mobile dev environment
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y curl rsync git libatomic1
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
@l3laze
l3laze / kcov-arm-ubuntu.sh
Last active July 6, 2020 00:40
kcov ARM build script
#!/usr/bin/env bash
#
# Installs dependencies and builds kcov from [tagged] source, and
# + then installs it to /usr/local/bin/kcov.
#
# Tested on Ubuntu 18.04 running on an ARMv8a processor
# + (ARM Cortex-A53 in LG Rebel 4) through UserLAnd on Android 8.
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y cmake g++ python3 git binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
@l3laze
l3laze / memba.sh
Created September 12, 2018 08:22
Package-manager-like tool for commands, memba?
#!/usr/bin/env bash
#
# Memba - A "package manager" for global and local commands.
#
# Follows the suggested exit code range of 0 & 64-113 from http://www.tldp.org/LDP/abs/html/exitcodes.html
#
# | Exit Code | Meaning |
# | --- | --- |
# | 64 | Error -- no command |
# | 65 | Error -- unknown command |
@l3laze
l3laze / getdependency.sh
Created August 27, 2017 21:34
My first attempt at a Bash download/install/cache tool. Alpha at best. Didn't need it's own repo.
#!/bin/bash
#
# Include source file and line number in xtrace messages
# From http://wiki.bash-hackers.org/scripting/debuggingtips#making_xtrace_more_useful
#
# export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
#
# Enable xtrace for debugging.
@l3laze
l3laze / lilman.sh
Created August 27, 2017 21:33
A little Bash "dependency manager" with download/install/cache powers. Beta at best.
#!/usr/bin/env bash
#
# lilman - A little "dependency manager" with download/cache/install powers.
#
# Follows the suggested exit code range of 0 & 64-113 from http://www.tldp.org/LDP/abs/html/exitcodes.html
#
# Note: This is beta at best; still trying to work out some problems and may actually rewrite this (again) completely.
# Note 2: Moved to a Gist because it doesn't need it's own repo as far as I'm concerned.
# Include source file and line number in xtrace messages