Skip to content

Instantly share code, notes, and snippets.

View AvnerCohen's full-sized avatar
Working from home

Avner Cohen AvnerCohen

Working from home
View GitHub Profile
AvnerCohen /
Created February 16, 2023 13:14
Retry bash and sleep between retries, also limit number retries
until [[ $RETURN_CODE -eq "0" || $counter -ge $RETRIES ]] ; do
# next line you should run the command, false and echo are just sample placeholders for the test
AvnerCohen / osx_volume_balance_fix.script
Last active March 7, 2023 09:56
OSX Apple Script - Jabra mute fix (input volume) and Balance fix (just a wtf)
while true ; do
osascript -e "set volume input volume 100"
echo "$(date): Increased volume"
sleep 1;
AvnerCohen /
Created June 23, 2022 12:48
boto3 based script to find ELB (AWS Load balancers) without targets (very näive, use with cautios)
import boto3
def main():
client = boto3.client('elbv2')
load_balancers = client.describe_load_balancers()
for lb in load_balancers['LoadBalancers']:
lb_arn = lb['LoadBalancerArn']
attr_for_lb = client.describe_listeners(LoadBalancerArn=lb_arn)
AvnerCohen /
Created April 25, 2022 18:00
Find and Install On Mac, Latest Iterm2
#!/bin/bash -e
URL_TO_DOWNLOAD=$(curl -s "" | grep "" | head -1 | awk '/http/{ print $4 }' | sed -e 's/"/\n/g' | sed -n '2p')
curl -L -s -o $URL_TO_DOWNLOAD
mv /Applications
echo "Done - Installed - ${URL_TO_DOWNLOAD}"
AvnerCohen /
Created May 20, 2021 06:31
Automatic Git Tagging for Shared Libraries
# When executing in circleci, make sure a user is defined in git config
CURRENT_NAME=$(git config
if [[ -z $CUR_NAME ]]; then
git config "CI USER"
git config
echo "Git names init done."
AvnerCohen / example.ts
Created May 31, 2020 13:54
Deno standard library MD5 example.
import { Md5 } from ""
const md5 = new Md5();
// Other hash functions -
AvnerCohen /
Last active May 24, 2020 20:53
SOX Examples - Various Audio manipulations

Use to cut 5 seconds from end of the file.

sox input output reverse trim 5 reverse

Converts the samplerate to 48kHz:

sox infile.wav -r 48k outfile.wav

AvnerCohen /
Created November 27, 2019 20:13
Show List of files changed since last commit - allow to feed that into CI operations that needs some optimization, say linting on YAMLs
#!/bin/bash -e
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
git diff --name-only --diff-filter=ACM $LATEST_TAG HEAD
AvnerCohen /
Created July 26, 2018 11:57
Install popller and pdfparser on Centos 6 / Amazon AMI
#!/bin/bash -e
set -x
# Poppler is used by resume parser for a faster PDF data extraction.
# Deploy is a bit man ual and complicated because of the C libs involved
# the fact no pip is used (anaconda and not virtualenev) and that the
# Cmake version eeds to be be udpated as part of it.
AvnerCohen / random.rb
Created July 1, 2018 14:04
Test Gist
Random gist with no data.
Testing the alers