Skip to content

Instantly share code, notes, and snippets.

View Efrat19's full-sized avatar
🐤
Poking around

Efrat Levitan Efrat19

🐤
Poking around
View GitHub Profile
@Efrat19
Efrat19 / clone-elastic-settings.sh
Last active October 22, 2019 11:56
clone all elastic indexes settings & mapping
#! /bin/bash
# in this script I assume you got elasticdump installed. https://github.com/taskrabbit/elasticsearch-dump
# if not, either run
# npm i -g elasticdump
# or use npx.
export SOURCE_HOST=http://localhost:9200
export DEST_HOST=http://localhost:9201
@Efrat19
Efrat19 / docker-compose-elasticsearch.yml
Created October 15, 2019 02:02
very quick ek stack
version: "3.7"
services:
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:7.4.0
environment:
- discovery.type=single-node
kibana:
image: docker.elastic.co/kibana/kibana:7.4.0
ports:
- 5601:5601
@Efrat19
Efrat19 / index.html
Created November 11, 2019 13:30
Sad Emoji Animation CSS
<p>SAD EMOJI ANIMATION</p>
<div class='container'>
<div class='tear'></div>
<div class='tear2'></div>
<div class='face'>
<div class='eyebrow'>︶</div>
<div class='eyebrow'>︶</div>
<div class='eye'></div>
<div class='eye'></div>
@Efrat19
Efrat19 / index.html
Created November 11, 2019 23:18
Pure CSS Emoji
<div class="head">
<div class="face face__happy">
<div class="eye-left"></div>
<div class="eye-right"></div>
<div class="mouth"></div>
</div>
</div>
<div class="head">
<div class="face face__standard">
<div class="eye-left"></div>
@Efrat19
Efrat19 / s3 size
Created November 28, 2019 13:00
s3 size
aws s3 ls s3://<bucket_name> --recursive | awk 'BEGIN {total=0}{total+=$3}END{print total/1024/1024" MB"}'
@Efrat19
Efrat19 / toUTF8.sh
Last active December 10, 2019 15:26
convert dir to utf8
#!/bin/bash
#enter input encoding here
FROM_ENCODING="WINDOWS-1255"
#output encoding(UTF-8)
TO_ENCODING="UTF-8"
#convert
CONVERT=" iconv -f $FROM_ENCODING -t $TO_ENCODING"
#loop to convert multiple files
for file in $(find $1 -type f -name "*.php"); do
$CONVERT "$file" > "${file}.encoded" && mv "${file}.encoded" $file
# listen on port 25 and notify on slack if the program tries to send mail through
msg2slack() {
read MESSAGE
echo "PID: $$"
echo "$MESSAGE"
msg="connection attempt to port 25 on $(cat /etc/hostname):\n$MESSAGE"
$DETECTMAIL_SLACK_URL && curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"$msg\"}" $DETECTMAIL_SLACK_URL
}
@Efrat19
Efrat19 / get-public-ip
Created December 25, 2019 12:08
get public ip
curl -s http://checkip.dyndns.org/ | cut -d ' ' -f 6 | sed s/"body\|html\|<\|>\|\/"//g
@Efrat19
Efrat19 / deletebranch.sh
Last active January 29, 2020 10:15
delete git branches
git branch -r > branch.txt
# delete master branch and "/origin" from branch.txt, and then:
for i in $(cat branch.txt); do sleep 1 && git push origin --delete $i & done
#!/bin/bash
KEY=dr.newadmin
VALUE=a88dd1213cf1811e9803406c5e12f321-536496363.eu-west-1.elb.amazonaws.com
HOSTED_ZONE_ID=Z2JG04O2LDY5NZ
# Creates route 53 records based on KEY name
aws route53 change-resource-record-sets --hosted-zone-id $HOSTED_ZONE_ID --change-batch '{ "Comment": "Testing creating a record set", "Changes": [ { "Action": "CREATE", "ResourceRecordSet": { "Name": "'"$KEY"'.hosted.zone.com", "Type": "CNAME", "TTL": 120, "ResourceRecords": [ { "Value": "'"$VALUE"'" } ] } } ] }'