This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# If arg numbers ($#) is 0 display usage message. | |
[[ $# -eq 0 || -z $1 || -z $2 || -z $3 ]] && { | |
# <repo-name> string string Org name followed by repo name e.g. google/coding-with-chrome | |
printf 'Usage: %s <application-name> <deployment-group> <repo-name> <commit-id> | |
<application-name> string CodeDeploy Application name | |
<deployment-group> string CodeDeploy Development Group name | |
<commit-id> string git commit SHA1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def move_s3_key(source, destination_key, destination_bucket=None): | |
"""Moves s3 key from source bucket to destination bucket | |
Arguments: | |
source {dict} -- A dictionary containing 'Bucket' and 'Key' | |
destination_key {str} -- Destination key | |
Keyword Arguments: | |
destination_bucket {str} -- Desitnation bucket (default: {None}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install pillow | |
from PIL import Image, IptcImagePlugin | |
im = Image.open('/home/bhaskark/Pictures/iptc-test.jpg') | |
iptc = IptcImagePlugin.getiptcinfo(im) | |
if iptc: | |
for k, v in iptc.items(): | |
print("{} {}".format(k, repr(v.decode()))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ready services required by codedeploy | |
# restart codedeploy-agent and nginx server | |
function restart_svc_n_wait() { | |
gem install net-telnet -v 0.1.1 | |
puppet agent -tv | |
/etc/init.d/codedeploy-agent restart | |
/etc/init.d/nginx restart | |
# time to ready service to available | |
sleep 5 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Does health check of an article | |
# curl request to the TEST_URL | |
# | |
# Returns the exit code | |
function article_health_check() { | |
response=$(curl -sL -w "%{http_code}" ${TEST_URL} -o /dev/null) | |
if [ $response -eq 200 ]; then | |
return 0 | |
else | |
return 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Public: Execute commands until 5 consecutive time waiting 15 seconds in each retries. | |
# | |
# Takes a single argument. | |
# | |
# $@ - Passed argument to be executed. | |
# | |
# Examples | |
# | |
# retry rake spec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto lo | |
iface lo inet loopback | |
iface eth0 inet dhcp | |
allow-hotplug wlan0 | |
iface wlan0 inet manual | |
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf | |
iface default inet dhcp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Returns attachment ids from the string using regex. | |
* match string "wp-image-{the-id-here}" | |
* regex101 link: https://regex101.com/r/aacOaV/1/ | |
* | |
* @param string $content | |
* @return array array of attachment ids. | |
*/ | |
public function get_attachment_ids_from_content( $content ) { |