Skip to content

Instantly share code, notes, and snippets.

View alexrashed's full-sized avatar
🚀

Alexander Rashed alexrashed

🚀
View GitHub Profile
@alexrashed
alexrashed / follow.sh
Last active March 14, 2024 11:06
Follow CircleCI and GitHub workflows by URL
#!/bin/bash
set -euo pipefail
# Prerequisites:
# - await.sh: https://gist.github.com/alexrashed/9dc04e78cff737b7cbb42861b6555221#file-await-sh
# - ntfy: https://github.com/binwiederhier/ntfy
# - Github CLI: https://cli.github.com/
if [[ $# -eq 0 ]]; then
echo "No URL given, trying to get URL for PR in current branch..."
@alexrashed
alexrashed / Dockerfile
Created June 20, 2023 11:47
Dockerfile buildx secret env
# syntax=docker/dockerfile:1.3
FROM busybox
RUN --mount=type=secret,id=GITHUB_TOKEN echo "This is the token: $(cat /run/secrets/GITHUB_TOKEN)"
@alexrashed
alexrashed / README.md
Created May 26, 2023 10:57
Conda Multi-Env PoC

activate conda in shell with this command

eval "$(/home/localstack/anaconda3/bin/conda shell.bash hook)"

configure bioconda

conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge
@alexrashed
alexrashed / await.sh
Last active February 20, 2023 08:24
await circle ci workflow to finish
#!/bin/bash
# Simple bash script to wait for a worfklwo to finish (f.e. to trigger a notification)
# Based on https://github.com/rockymadden/circleci-cli
token=$CIRCLECI_TOKEN
resolution=15
workflow=$1
function await() {
function go() {
@alexrashed
alexrashed / boto-test-overloading-assumptions.py
Created February 16, 2022 14:13
Script to test assumptions on the requestURI overloading for rest-* protocols in AWS
from collections import defaultdict
from typing import List
import logging
from botocore.model import OperationModel
from localstack.aws.spec import list_services
def resolvable(operation_models: List[OperationModel]):
@alexrashed
alexrashed / boto-test-shape-assumptions.py
Last active February 17, 2022 11:01
Script to test botocore service spec service and shape assumptions
from typing import cast, Callable
from botocore.model import StructureShape, ListShape, Shape, MapShape, ServiceModel
from localstack.aws.spec import list_services
def traverse_members(service: ServiceModel, shape: Shape, fun: Callable, traversed_shapes=None, hierarchy=0):
if traversed_shapes is None:
traversed_shapes = []
@alexrashed
alexrashed / gist:159748c93303bc20a0bbe275194cb9fd
Created November 10, 2021 08:16
Biggest packages in Alpine and Debian (human readable)
# Alpine
apk add coreutils
apk info | xargs -n1 -I{} apk info -s {} | xargs -n4 | awk '{print $4,$1}' | numfmt --field=1 --to=iec-i --suffix=B | sort -rh | head -n20
# Debian
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | awk '{print $1,$2}' | numfmt --field=1 --from-unit=1024 --to=iec-i --suffix=B | sort -rh | head -n20
@alexrashed
alexrashed / ikea-five-button-remote-fixed-toggle.yaml
Last active October 26, 2021 13:53
Ikea Five Button Remote Blueprint - Fixed Light Toggle
blueprint:
name: Z2M - IKEA five button remote for lights - Fixed toggle
description: |
Control lights with an IKEA five button remote (the round ones).
The middle "on" button, toggle the lights on/off to the last set brightness
(unless the force brightness is toggled on in the blueprint).
If any light in the target is turned on it will be turned off, otherwise it will be turned on.
@alexrashed
alexrashed / zfs-ext4-docker.sh
Created October 7, 2021 11:48
Creates a new ZFS volume for docker with ext4
#!/bin/bash
# This is just a writeup to build an ext4 FS on top of ZFS to overcome issues with the Docker ZFS storage driver.
# DO NOT EXECUTE THIS SCRIPT IF YOU DO NOT KNOW WHAT YOU'RE DOING!
sudo zfs create -V 100G rpool/docker-overlay
sudo mkfs.ext4 /dev/zvol/rpool/docker-overlay
sudo mount /dev/zvol/rpool/docker-overlay /var/lib/docker-overlay
docker system prune -af
sudo su
cat > /etc/docker/daemon.json << EOF
{
@alexrashed
alexrashed / libreelec-ir-remote.md
Created February 5, 2021 19:10
IR Remote on LibreElec
  • Enable gpio-ir on GPIO port 18
    mount -o remount,rw /flash
    echo "dtoverlay=gpio-ir,gpio_pin=18" >> /flash/config.txt
    
  • Get codes sent by IR remote
    ir-keytable -p all -t
    
  • Create keymap in /storage/.config/rc_keymaps/