Retrieving Response Headers by Golang
Retrieving Response Headers by Golang
res, _ := client.Do(req)
contentType := res.Header.Get("Content-Type")
contentLength := res.Header.Get("Content-Length")
Retrieving Response Headers by Golang
res, _ := client.Do(req)
contentType := res.Header.Get("Content-Type")
contentLength := res.Header.Get("Content-Length")
You can check this at here.
goris is a CLI tool to search for images with Google Reverse Image Search.
Today, it was updated to v1.0.1. Please check it out. https://github.com/tanaikech/goris
When number of retrieved URLs is smaller than number of default output, an error had occurred. This was fixed.
This is a sample data for this sample script. The column B was created by the normal distribution formula, and the column C was created by multiplying random number for column B.
A, B, C
1.0, 0.0001, 0.0000
1.5, 0.0009, 0.0006
2.0, 0.0044, 0.0037
2.5, 0.0175, 0.0133
3.0, 0.0540, 0.0236
3.5, 0.1296, 0.0533
4.0, 0.2420, 0.0073
4.5, 0.3522, 0.2468
5.0, 0.3990, 0.0843
5.5, 0.3522, 0.3352
6.0, 0.2420, 0.2201
6.5, 0.1296, 0.0607
7.0, 0.0540, 0.0256
7.5, 0.0175, 0.0006
8.0, 0.0044, 0.0030
8.5, 0.0009, 0.0005
9.0, 0.0001, 0.0001
createChart() creates a chart from data. A chart with 2 lines is created by this method.
This sample script sends an e-mail, when spreadsheet was edited from outside by Sheet API v4. When you use this sample, please create a container bound script with spreadsheet which is edited by Sheet API. And please input your e-mail and run firstly a method of createTrigger(). By this, a trigger is installed as onChange(). After this, edit spreadsheet from outside by Sheet API v4.
When when spreadsheet was edited from outside by Sheet API v4, I used sendEmail() as a sample, because script editor is closed.
In this article, I would like to introduce how to transfer files for Google Drive under no authorization.
This has also been published here. https://github.com/tanaikech/FileTransfer
When we download and upload files for Google Drive, it usually has to use Drive API. In order to use Drive API, access token is required. If you want to make your friends download and upload files for your Google Drive, the authorization process is to take time. So I proposal this.
This sample script dynamically creates nested JSON objects.
obj := map[string]interface{}{}
for i := 1; i <= 5; i++ {
value := map[string]interface{}{
fmt.Sprintf("B_key%d", i): map[string]interface{}{
"C_key": "value",
},
}
obj[fmt.Sprintf("A_key%d", i)] = value
}
{
"A_key1": {
"B_key1": {
"C_key": "value"
}
},
"A_key2": {
"B_key2": {
"C_key": "value"
}
},
"A_key3": {
"B_key3": {
"C_key": "value"
}
},
"A_key4": {
"B_key4": {
"C_key": "value"
}
},
"A_key5": {
"B_key5": {
"C_key": "value"
}
}
}
This script changes slack status using GAS. If you want to change it on time you decided, it can be achieved by installing this method as a trigger.
In order to use this, the required scope is users.profile:write.
function setSlackStatus(token, user, status_text, status_emoji) {
return UrlFetchApp.fetch(
'https://slack.com/api/users.profile.set',
{
method: 'post',
payload: {
token: token,
user: user,
profile: JSON.stringify({status_text: status_text, status_emoji: status_emoji})
},
muteHttpExceptions: true
}
).getContentText();
}
function main() {
var res = setSlackStatus(
'### Your access token ###',
'### User ID ###',
'sample',
':coffee:'
);
Logger.log(res)
}
text.txt :
{
"values": [
[
"a1",
"b1",
"c1"
],
[
"a2",
"b2",
"c2"
],
[
"a3",
"b3",
"c3"
],
[
"a4",
"b4",
"c4"
],
[
"a5",
"b5",
"c5"
]
]
}
type text.txt | jq -c "."
$ cat text.txt | jq -c '.'
{"values":[["a1","b1","c1"],["a2","b2","c2"],["a3","b3","c3"],["a4","b4","c4"],["a5","b5","c5"]]}
gogauth is a CLI tool to easily retrieve access token for using APIs on Google.
I thought that if the access token can easily retrieve, it may be useful for users who can use various convenience Google APIs. So I created this. Also this can be used for testing sample script like the demo. If this will be helpful for you, I’m glad.
Today, it was updated to v2.0.1. Please check it out. https://github.com/tanaikech/gogauth