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
AvnerCohen / nginx_install_more_headers.sh
Created November 5, 2017 13:15
Install nginx with clear_more_headers - Latest Version 1.13.6
yum update -y nginx
yum install -y pcre-devel
service nginx stop
mkdir ~/nginx_test
cd ~/nginx_test/
wget 'http://nginx.org/download/nginx-1.13.6.tar.gz'
tar -xzvf nginx-1.13.6.tar.gz
wget https://github.com/openresty/headers-more-nginx-module/archive/v0.33.tar.gz
tar -xzvf v0.33.tar.gz
cd nginx-1.13.6/
[default]
aws_access_key_id = AKIHONEYPOTHONEYPPKA
aws_secret_access_key = juBYW/RHTE1ki+DyDFG/uPIhtwO9hm9+8+ErzMo9
honeypot = True
@AvnerCohen
AvnerCohen / random.rb
Created July 1, 2018 14:04
Test Gist
Random gist with no data.
Testing the alers
@AvnerCohen
AvnerCohen / sorted_git_tags.md
Last active July 21, 2018 18:39
A sorted list of git tags - A simple way to create a git alias to a sorted list of tags, sorted by their creation date, and not alphanumerically.

Extract a sorted by creation list list of git repository tags:

The git command line:

git for-each-ref --format='%(*committerdate:raw)%(committerdate:raw) %(refname) %(*objectname) %(objectname)' refs/tags | sort -n | cut -d'/' -f 3 | cut -d' ' -f 1

Create a new git alias for it (stags - Sorted tags):

@AvnerCohen
AvnerCohen / python2.7.xx.bash
Last active October 25, 2018 10:12
Updated Python 2.7.xx on an Amazon AMI + make it default (in alternatives) and symlik pip ad virtualenv for future usage
#!/usr/bin/env bash
NEW_VERSION="2.7.14"
CURRENT_VERSION="$(python -V 2>&1)"
if [[ "$CURRENT_VERSION" == "Python $NEW_VERSION" ]]; then
echo "Python $NEW_VERSION already installed, aborting."
else
echo "Starting upgrade from ${CURRENT_VERSION} to ${NEW_VERSION}"
@AvnerCohen
AvnerCohen / changed_since_last_commit.sh
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
AvnerCohen / glog.sh
Created October 16, 2012 16:13
Nicer and more compact view for "git log" command
alias glog="git log --graph --pretty=\"format:%C(yellow)%h%Cred%d%Creset %s %C(white) %C(cyan)%an%Creset, %C(green)%ar%Creset\""
@AvnerCohen
AvnerCohen / sox_examples.md
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
AvnerCohen / example.ts
Created May 31, 2020 13:54
Deno standard library MD5 example.
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 / auto-tag.sh
Created May 20, 2021 06:31
Automatic Git Tagging for Shared Libraries
#!/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