Skip to content

Instantly share code, notes, and snippets.

@kuvaldini
kuvaldini / git-nlx
Created Aug 10, 2022
Git extended log
View git-nlx
#!/usr/bin/env bash
set -euo pipefail
var_is_unset(){
declare -rn var=$1
test -z ${var+x}
}
while test $# -gt 0 ;do
case $1 in
@kuvaldini
kuvaldini / git-nlx
Last active Jul 6, 2022
Git nice log extended
View git-nlx
#!/usr/bin/env bash
set -euo pipefail
var_is_unset(){
declare -rn var=$1
test -z ${var+x}
}
while test $# -gt 0 ;do
case $1 in
View fibo.cpp
#include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter Fibonacci index: ";
cin >> n;
if(n <= 1){
cout << n << endl;
}
@kuvaldini
kuvaldini / Build-Linaro-on-Mac.md
Created Dec 8, 2021
Build Linaro toolchain for Mac
View Build-Linaro-on-Mac.md

Build Linaro toolchain on Mac

Prepare env

Abe requires Bash version 4+.

brew install bash
brew install autogen dejagnu coreutils gcc gawk git-new-workdir 
View Build-Cross-Compiler.md

Building Cross Compiler

  1. Environment

export TARGET=arm-linux-gnueabihf
export CROSS_PREFIX=/opt/crosstools/$TARGET
mkdir -p $CROSS_PREFIX
mkdir ~/src ~/build
@kuvaldini
kuvaldini / conditional_wait_for.cpp
Last active Oct 23, 2021
Without lambda works as expected, but with lambda look more like spin lock.
View conditional_wait_for.cpp
#include <iostream>
#include <thread>
#include <chrono>
#include <condition_variable>
using namespace std;
using namespace std::chrono;
using namespace std::chrono_literals;
std::mutex expiration_thread_work_mutex_;
@kuvaldini
kuvaldini / .alias.gitconfig
Last active Jul 6, 2022
Useful aliases for Git
View .alias.gitconfig
[alias]
sta = status
bra = branch
co = checkout
cos = checkout --recurse-submodule
cosf = checkout --recurse-submodule --force
root = rev-parse --show-toplevel
toplevel = rev-parse --show-toplevel
current-branch = rev-parse --abbrev-ref HEAD
sub = submodule
@kuvaldini
kuvaldini / curl-docker-tags.sh
Created Aug 2, 2021
A shell script to request tags of docker repository from DockerHub using curl and jq
View curl-docker-tags.sh
#!/usr/bin/env bash
set -xeuo pipefail
shopt -s lastpipe
[[ $1 = */* ]]
org=${1%%/*}
repo=${1#*/}
org=${org:-hyperledger}
repo=${repo:-iroha}
@kuvaldini
kuvaldini / make-workflows.sh
Created Jul 3, 2021
Script to expand YAML anchors in GitHub Actions workflows
View make-workflows.sh
#!/usr/bin/env bash
set -euo pipefail
--help(){
cat<<'END'
make-workflows:
This script expands '*.src.yml' from $1 (default: script's directory)
to $2 (default:REPO_ROOT/.github/workflows) with corresponding name '*.yml'
Main goal is to dereference YAML anchors.
View build-amba.bash
( export RING_NAME=s2lm_orion && make -sj16 prepare_conf && make -sj16 && make -sj16 fs_image; )