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
RESOURCE="/${OSS_BUCKET_NAME}/${OBJECT_NAME}" | |
CONTENT_MD5=$(openssl dgst -md5 -binary "${FILEPATH}" | openssl enc -base64) | |
CONTENT_TYPE=$(file -ib "${FILEPATH}" |awk -F ";" '{print $1}') | |
DATE_VALUE="`TZ=GMT date +'%a, %d %b %Y %H:%M:%S GMT'`" | |
STRING_TO_SIGN="PUT\n${CONTENT_MD5}\n${CONTENT_TYPE}\n${DATE_VALUE}\n${RESOURCE}" | |
SIGNATURE=$(echo -e -n $STRING_TO_SIGN | openssl dgst -sha1 -binary -hmac $OSS_ACCESS_KEY_SECRET | openssl enc -base64) | |
URL="http://${OSS_BUCKET_NAME}.${OSS_REGION}.aliyuncs.com/${OBJECT_NAME}" | |
curl -i -q -X PUT -T "${FILEPATH}" \ | |
-H "Host: ${OSS_BUCKET_NAME}.${OSS_REGION}.aliyuncs.com" \ | |
-H "Date: ${DATE_VALUE}" \ |
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
## Install Consul | |
1. download consul | |
``` | |
wget https://releases.hashicorp.com/consul/1.7.3/consul_1.7.3_linux_amd64.zip | |
``` | |
2. unzip to `/usr/bin` | |
``` | |
sudo unzip consul_1.7.3_linux_amd64.zip -d /usr/bin |
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
import os | |
import signal | |
import subprocess | |
# Making sure to use virtual environment libraries | |
activate_this = "/home/ubuntu/tensorflow/bin/activate_this.py" | |
exec(open(activate_this).read(), dict(__file__=activate_this)) | |
# Change directory to where your Flask's app.py is present | |
os.chdir("/home/ubuntu/Desktop/Medium/keras-and-tensorflow-serving/flask_server") |
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
log_format json_http_combined escape=json | |
'{ "@timestamp":"$time_iso8601",' | |
'"server_name":"$server_name",' | |
'"status":$status,' | |
'"bytes_sent":$bytes_sent,' | |
'"body_bytes_sent":$body_bytes_sent,' | |
'"remote_addr":"$remote_addr",' | |
'"request_time":$request_time,' | |
'"request_id":"$request_id",' |
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
DROP TABLE IF EXISTS location; | |
CREATE TABLE IF NOT EXISTS `location` ( | |
`locId` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`country` varchar(2) DEFAULT NULL, | |
`region` varchar(2) DEFAULT NULL, | |
`city` varchar(1000) DEFAULT NULL, | |
`postalCode` varchar(10) DEFAULT NULL, | |
`latitude` float DEFAULT NULL, | |
`longitude` float DEFAULT NULL, |
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
#!/usr/bin/env python3 | |
# Use: ./subnet.py <ip/cidr> | |
# Alt: ./subnet.py <ip> <mask> | |
import sys | |
if __name__=="__main__": | |
addr = [0, 0, 0, 0] | |
mask = [0, 0, 0, 0] | |
cidr = 0 |
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
#!/usr/bin/env python3 | |
# Use: ./subnet.py <ip/cidr> | |
# Alt: ./subnet.py <ip> <mask> | |
import sys | |
if __name__=="__main__": | |
addr = [0, 0, 0, 0] | |
mask = [0, 0, 0, 0] | |
cidr = 0 |
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
if ($request_uri = /) { | |
set $test A; | |
} | |
if ($host ~* teambox.com) { | |
set $test "${test}B"; | |
} | |
if ($http_cookie !~* "auth_token") { | |
set $test "${test}C"; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Bootstrap Table Checkbox Select All and Cancel</title> | |
<link href="//cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> | |
</head> | |
<body> | |
<h2>Bootstrap Table Checkbox Select All and Cancel</h2> | |
<table class="table table-striped"> |
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
-- a quick LUA access script for nginx to check IP addresses against an | |
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403. | |
-- | |
-- allows for a common blacklist to be shared between a bunch of nginx | |
-- web servers using a remote redis instance. lookups are cached for a | |
-- configurable period of time. | |
-- | |
-- block an ip: | |
-- redis-cli SADD ip_blacklist 10.1.1.1 | |
-- remove an ip: |