View generateUniqueRandomIntegers.gs
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
function generateUniqueRandomIntegers() { | |
var generatedNumbers = {}; | |
var uniqueNumbers = []; | |
while (uniqueNumbers.length < 200) { | |
// 6桁の整数を生成: 100000 から 999999 の範囲 | |
var randomNumber = Math.floor(Math.random() * (999999 - 100000 + 1)) + 100000; | |
if (!generatedNumbers[randomNumber]) { // この数値がまだリストに含まれていないか確認 | |
generatedNumbers[randomNumber] = true; | |
uniqueNumbers.push(randomNumber); |
View getUserEmailsInCourse.gs
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
function getUserEmailsInCourse(courseId) { | |
var emailList = []; | |
var nextPageToken; | |
do { | |
var response = Classroom.Courses.Students.list(courseId, { | |
pageToken: nextPageToken | |
}); | |
var students = response.students; |
View googleAuthSample.py
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
from __future__ import print_function | |
import os.path | |
from google.auth.transport.requests import Request | |
from google.oauth2.credentials import Credentials | |
from google_auth_oauthlib.flow import InstalledAppFlow | |
from googleapiclient.discovery import build | |
from googleapiclient.errors import HttpError |
View createQuizForm.gs
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
function createQuizForm() { | |
var row=10; //問題数 | |
var col=7; //シートの列数 | |
var form = FormApp.create('クイズフォーム(自動生成)'); // フォームのタイトルを設定 | |
form.setIsQuiz(true); | |
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); | |
//シートのデータを全部取得 | |
var data = sheet.getDataRange().getValues(); |
View installMecabToColab.sh
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
### MeCabと辞書をインストール | |
!sudo apt install mecab | |
!sudo apt install libmecab-dev | |
!sudo apt install mecab-ipadic-utf8 | |
### 辞書を使える場所に移す | |
!mv /etc/mecabrc /usr/local/etc/ | |
### Mecabライブラリのインストール | |
!pip3 install mecab-python3 |
View moveGCalEvent.gs
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
function moveGCalEvent(event,targetCalendarId) { | |
var targetCalendar = CalendarApp.getCalendarById(targetCalendarId); | |
// イベントの詳細を取得 | |
var eventTitle= event.getTitle(); | |
var date =event.getAllDayStartDate(); //終日イベントが対象 | |
// 新しいカレンダーに同じイベントを作成 | |
var newEvent = targetCalendar.createAllDayEvent(eventTitle,date); | |
// 元のカレンダーから旧イベントを削除 | |
event.deleteEvent(); |
View todoistGetCompleteItems.gs
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
/** | |
sinceから現在まですべてのタスクをとってくる | |
since: 取得開始する日時 (2023-06-26 というフォーマットの文字列) | |
**/ | |
function todoistGetCompleteItems(since) { | |
const token = PropertiesService.getScriptProperties().getProperty('TODOIST_TOKEN'); | |
const url = 'https://api.todoist.com/sync/v9/completed/get_all?since='+since+'T00:00:00'; | |
const params = { | |
headers: { 'Authorization': `Bearer ${token}` } | |
}; |
View assignScriptsToImages.gs
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
function assignScriptsToImages() { | |
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); | |
var images =sheet.getImages(); | |
for(var i=0;i<images.length;i++){ | |
switch(images[i].getAltTextTitle()){ | |
case "risu": | |
images[i].assignScript("risuSay"); | |
break; | |
case "momo": | |
images[i].assignScript("momoSay"); |
View getJointData.py
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 numpy as np | |
import cv2 | |
import pykinect_azure as pykinect | |
if __name__ == “__main__“: | |
# Initialize the library, if the library is not found, add the library path as argument | |
pykinect.initialize_libraries(track_body=True) | |
# Modify camera configuration | |
device_config = pykinect.default_configuration | |
device_config.color_resolution = pykinect.K4A_COLOR_RESOLUTION_OFF | |
device_config.depth_mode = pykinect.K4A_DEPTH_MODE_WFOV_2X2BINNED |
View setValue.gs
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
function doPost(e){ | |
var params = JSON.parse(e.postData.getDataAsString()); | |
var data = params.data; | |
//// 以下の範囲独自処理を書く | |
//シートへの書き込み | |
const ss = SpreadsheetApp.getActiveSpreadsheet(); | |
const sheet = ss.getSheetByName('シート1'); |
NewerOlder