This file contains 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
#! /bin/bash | |
# The approx. time to run this script is 145 ms. | |
# First we extract the private PEM key from the .p12 file: | |
# openssl pkcs12 -nocerts -passin 'notasecret' -in file.p12 -out ~/google/google.privatekey.pem | |
KEY='~/google/google.privatekey.pem' | |
# The fields are ordered by their hash values. | |
# In Google Client for Java HashMap is used to stack all JSON fields, so String.hashCode() is used for ordering. |
This file contains 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
#echo "access_token = $access_token" # valid for 3600 seconds | |
access_token=ya29.1.AADtN_XKybIzhN-3SUdWkwm2AETJWRKjaiimgTA4U2tR2yF2R42b16Ipz-03FfUI | |
# The while-loop waits 60 seconds for Redis to start after reboot | |
cnt=0 | |
PING=$(/usr/local/bin/redis-cli PING 2>&1) # stderr to stdout | |
while [ "$PING" != "PONG" ] && (($cnt < 6)); do | |
sleep 10; | |
let cnt=$cnt+1 |
This file contains 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
{ | |
"kind": "youtube#videoListResponse", | |
"etag": "\"N5Eg36Gl054SUNiWWc-Su3t5O-k/znsgxR5z9807wYDi_7GxzUgNXOc\"", | |
"pageInfo": { | |
"totalResults": 1, | |
"resultsPerPage": 1 | |
}, | |
"items": [ | |
{ | |
"kind": "youtube#video", |
This file contains 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
#! /bin/bash | |
table=(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 - _ =) | |
#text="{\"alg\":\"RS256\",\"typ\":\"JWT\"}" | |
#text="{\"iss\":\"761326798069-r5mljlln1rd4lrbhg75efgigp36m78j5@developer.gserviceaccount.com\",\"scope\":\"https://www.googleapis.com/auth/prediction\",\"aud\":\"https://accounts.google.com/o/oauth2/token\",\"exp\":1328554385,\"iat\":1328550785}" | |
read text | |
# breaking binary represantation of $text in to 6-bit blocks |
This file contains 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
#! /bin/bash | |
table=(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 - _ =) | |
#text="{\"alg\":\"RS256\",\"typ\":\"JWT\"}" | |
#text="{\"iss\":\"761326798069-r5mljlln1rd4lrbhg75efgigp36m78j5@developer.gserviceaccount.com\",\"scope\":\"https://www.googleapis.com/auth/prediction\",\"aud\":\"https://accounts.google.com/o/oauth2/token\",\"exp\":1328554385,\"iat\":1328550785}" | |
read text | |
# breaking binary represantation of $text in to 6-bit blocks |
This file contains 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
#!/bin/bash | |
key='Публичный ключ'; | |
pr_key='Приватный ключ'; | |
action='getAddressbook'; echo -e "key=$key;version=3.0;action=$action" | \ | |
tr ';' '\n' | \ | |
sort -t'=' -k1 | \ | |
cut -f2 -d'=' | \ | |
paste -s -d';' - | \ |
This file contains 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
#!/bin/bash | |
key='Публичный ключ'; | |
pr_key='Приватный ключ'; | |
action='Команда'; echo -e "key=$key;version=3.0;action=$action;param1=val1;...;paramN=valN" | \ | |
tr ';' '\n' | \ | |
sort -t'=' -k1 | \ | |
cut -f2 -d'=' | \ | |
paste -s -d';' - | \ |
This file contains 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
#!/bin/bash | |
key='Публичный ключ'; | |
pr_key='Приватный ключ'; | |
action='getAllAddressBookVariables'; echo -e "key=$key;version=3.0;action=$action;idAddressBook=853365" | \ | |
tr ';' '\n' | \ | |
sort -t'=' -k1 | \ | |
cut -f2 -d'=' | \ | |
paste -s -d';' - | \ |
This file contains 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
#!/bin/bash | |
key='Публичный ключ'; | |
pr_key='Приватный ключ'; | |
action='checkCampaignPrice'; printf '%s;' "key=$key" 'version=3.0' "action=$action" 'sender=COMPANY' 'text=%Name% %NameMiddle%! Перед началом весеннего сезона хотим предложить новую машинку со скидкой по цене 3999 руб. Подробнее https://goo.gl/%URL% и тел. 84950000000' 'list_id=853365' 'type=2' | \ | |
sed 's/;$//' | tr ';' '\n' | \ | |
sort -t'=' -k1 | \ | |
cut -f2 -d'=' | \ | |
paste -s -d';' - | \ |
This file contains 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
#!/bin/bash | |
key='Публичный ключ'; | |
pr_key='Приватный ключ'; | |
action='createCampaign'; printf '%s;' "key=$key" 'version=3.0' "action=$action" 'sender=COMPANY' 'text=%Name% %NameMiddle%! Перед началом весеннего сезона хотим предложить новую машинку со скидкой по цене 3999 руб. Подробнее https://goo.gl/%URL% и тел. 84950000000' 'list_id=853365' 'type=2' | \ | |
sed 's/;$//' | tr ';' '\n' | \ | |
sort -t'=' -k1 | \ | |
cut -f2 -d'=' | \ | |
paste -s -d';' - | \ |
OlderNewer