Skip to content

Instantly share code, notes, and snippets.

View omar-yassin's full-sized avatar

Omar Yassin omar-yassin

View GitHub Profile
tail -f /tmp/log.log | egrep --line-buffered 'string' | ./slacktee.sh -n
@omar-yassin
omar-yassin / gist:9ba98d41417502401131ee5683e3643c
Created April 19, 2017 17:38
generate new CSR for new cert
openssl req -new -newkey rsa:2048 -nodes -keyout some-domain.key -out some-domain.csr
@omar-yassin
omar-yassin / gist:b746ffa05f385923e612eee4006949d4
Last active February 16, 2017 22:26
chef node search + create cluster ssh file
#!/bin/bash
# gsplit for OSX - brew install coreutils
# usage
# ./script_name aws-live prod-core-web
# will create files prod-core-web.00..x with 9 prod-core-web hosts in each. Then can feed to i2cssh or what ever cluster ssh tool you use
env=$1
name_prefix=$2
## kv
# POST key
curl -X PUT -d @- localhost:8500/v1/kv/some/key/ <<< key_value
# GET key
curl -s localhost:8500/v1/kv/some/key
# GET raw value
curl -s localhost:8500/v1/kv/some/key?raw
@omar-yassin
omar-yassin / gist:f26d8d5ecc7731a71686c77bddc86d33
Created January 17, 2017 18:29
Terraform interpolation with empty list
"${compact(split(",", var.asg_elb_names))}" # returns 0 array if var.asg_elb_names is an empty string
@omar-yassin
omar-yassin / gist:ce157fbab6ff5b062e39e29ae824f668
Created January 5, 2017 20:25
ELB: Parse for size, method and URL
# size, method, url
cut -d ' ' -f 11,12,13 elb.log | sort -rn
@omar-yassin
omar-yassin / gist:3844087136b54c73bdf10282ebdd751d
Created October 11, 2016 15:07
run program in background before exiting
control + z
disown -h %1
bg 1
@omar-yassin
omar-yassin / gist:dd997f4e59ea59634182b9b446a63a7e
Created October 6, 2016 17:16
BASH: loop through variable string, line by line
some_string_with_newlines="..."
while read -r line ; do
echo " xxx $line"
done <<< "$some_string_with_newlines"
brew install bash
sudo bash -c "echo /usr/local/bin/bash >> /private/etc/shells"
chsh -s /usr/local/bin/bash
@omar-yassin
omar-yassin / gist:2784d1feb32882b40efec7f129dbd76c
Last active October 21, 2016 00:48
mysql change password for user & change grants to read only
use mysql;
update user set password=PASSWORD('$new_password') where User='$user_name';
flush privileges;
# to change current user grants
revoke all privileges on *.* from 'user'@'%';
GRANT SELECT ON *.* TO 'user'@'%';
flush privileges;