Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Avner Cohen AvnerCohen

🏠
Working from home
View GitHub Profile
@AvnerCohen
AvnerCohen / osx_volume_balance_fix.script
Created Sep 20, 2022
OSX Apple Script - Jabra mute fix (input volume) and Balance fix (just a wtf)
View osx_volume_balance_fix.script
#!/usr/bin/osascript
set volume 100
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
delay .6
reveal (first anchor of current pane whose name is "output")
end tell
tell application "System Events"
@AvnerCohen
AvnerCohen / elb-with-no-targets.py
Created Jun 23, 2022
boto3 based script to find ELB (AWS Load balancers) without targets (very näive, use with cautios)
View elb-with-no-targets.py
import boto3
LB_TO_TARGET_ARN = {}
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
AvnerCohen / iterm2_install.sh
Created Apr 25, 2022
Find and Install On Mac, Latest Iterm2
View iterm2_install.sh
#!/bin/bash -e
URL_TO_DOWNLOAD=$(curl -s "https://iterm2.com/downloads.html" | grep "https://iterm2.com/downloads/stable/" | head -1 | awk '/http/{ print $4 }' | sed -e 's/"/\n/g' | sed -n '2p')
curl -L -s -o iTerm2.zip $URL_TO_DOWNLOAD
unzip iTerm2.zip
mv iTerm.app /Applications
rm iTerm2.zip
echo "Done - Installed - ${URL_TO_DOWNLOAD}"
@AvnerCohen
AvnerCohen / auto-tag.sh
Created May 20, 2021
Automatic Git Tagging for Shared Libraries
View auto-tag.sh
#!/bin/bash
# When executing in circleci, make sure a user is defined in git config
CURRENT_NAME=$(git config user.name)
if [[ -z $CUR_NAME ]]; then
git config user.name "CI USER"
git config user.email ci-user@companyname.biz
echo "Git names init done."
fi
@AvnerCohen
AvnerCohen / example.ts
Created May 31, 2020
Deno standard library MD5 example.
View example.ts
import { Md5 } from "https://deno.land/std/hash/md5.ts"
const md5 = new Md5();
d5.update("moshe").toString();
// Other hash functions - https://deno.land/std/hash
@AvnerCohen
AvnerCohen / sox_examples.md
Last active May 24, 2020
SOX Examples - Various Audio manipulations
View sox_examples.md

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
AvnerCohen / changed_since_last_commit.sh
Created Nov 27, 2019
Show List of files changed since last commit - allow to feed that into CI operations that needs some optimization, say linting on YAMLs
View changed_since_last_commit.sh
#!/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
AvnerCohen / install_poppler.sh
Created Jul 26, 2018
Install popller and pdfparser on Centos 6 / Amazon AMI
View install_poppler.sh
#!/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.
CMAKE_VERSION='3.6.2'
POPPLER_VERSION="poppler-0.67.0"
TARGET_DIR='/opt/poppler'
View random.rb
Random gist with no data.
Testing the alers
View gist:663597c3423f13ad0cb6527573eb24c5
[default]
aws_access_key_id = AKIHONEYPOTHONEYPPKA
aws_secret_access_key = juBYW/RHTE1ki+DyDFG/uPIhtwO9hm9+8+ErzMo9
honeypot = True