Skip to content

Instantly share code, notes, and snippets.

View nekonenene's full-sized avatar

ハトネコエ nekonenene

View GitHub Profile
@nekonenene
nekonenene / SyncCalendar.gs
Last active May 3, 2024 06:37
自身のGoogleカレンダーの予定すべてに対して特定のメアドを招待する Google Apps Script
const GUEST_EMAILS = [ // 招待するゲストのメールアドレス
'xxx@example.com',
];
const FETCHING_DAYS = 30; // 何日後までの予定を取得するか
function main() {
const dateFrom = new Date();
const dateTo = new Date(dateFrom.getTime() + (FETCHING_DAYS * 24 * 60 * 60 * 1000));
const calendar = Calendar.Calendars.get('primary');
@nekonenene
nekonenene / code.gs
Last active March 3, 2024 06:01
QQEnglish のレッスン予約完了メールを元に、Googleカレンダーのスケジュールを作成
// 1時間おきのトリガーを設定すること
// appsscript.json の timeZone を Asia/Tokyo にしておかないと変な時間にスケジュールが作られてしまうので注意
// QQEnglish のレッスン予約完了メールを元に、Googleカレンダーのスケジュールを作成
function getQQReservedLessonMail() {
const targetHours = 1;
const targetHoursInMilliSeconds = 60 * 60 * 1000 * targetHours;
const subject = "【QQEnglish】レッスン予約完了";
const query = (`newer_than:${targetHours}h subject:"${subject}"`);
const threads = GmailApp.search(query);
@nekonenene
nekonenene / main.go
Last active May 8, 2020 14:33
文字種類PのN文字をT回発行した時に重複する確率を 0.1% 未満にしたかった
package main
import (
"fmt"
"math"
)
// かぶらない可能性
// charPattern: 文字種, n: 文字数, tryCount: 試行回数
func notDuplicate(charPattern uint64, n uint64, tryCount uint64) float64 {
@nekonenene
nekonenene / main.go
Last active April 25, 2020 13:32
動画概要欄の古いURLを新しいURLに直す go script (ブログ公開用)
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"strings"
@nekonenene
nekonenene / SoundManager.cs
Created May 23, 2019 19:40
オーディオのフェードイン・フェードアウト:DOTween 使用(ブログ公開用)
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.Audio;
using DG.Tweening;
// Singleton として持ち続ける
public class SoundManager : MonoBehaviour {
static SoundManager instance;
@nekonenene
nekonenene / SoundManager.cs
Last active May 23, 2019 19:41
オーディオのフェードイン・フェードアウトを DOTween を使わずに実装する(ブログ公開用)
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.Audio;
// Singleton として持ち続ける
public class SoundManager : MonoBehaviour {
static SoundManager instance;
public AudioMixerGroup BGMMixerGroup;
@nekonenene
nekonenene / Fade.cs
Last active May 23, 2019 19:43
Unity uGUI のフェードアウト処理(ブログ公開用) https://nekonenene.hatenablog.com/entry/unity-ugui-fadeout-window
using System.Collections;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace Util {
public static class Fade {
public static void FadeoutObject(GameObject gameObject, float fadeoutSec = 2.0f) {
if (gameObject.GetComponent<Fadeout>()) return;
@nekonenene
nekonenene / config.yml
Last active May 23, 2019 19:44
Android アプリを deploygate にデプロイする CircleCI 2.0 設定(ブログ公開用) https://nekonenene.hatenablog.com/entry/circleci_2-deploygate-android
aliases:
android_docker: &android_docker
docker:
- image: circleci/android:api-28
environment:
TZ: Asia/Tokyo
steps:
- restore_cache: &restore_cache
key: &jars_key jars-{{ checksum "build.gradle.kts" }}-{{ checksum "app/build.gradle.kts" }}
- run: &download_deps
@nekonenene
nekonenene / client02.go
Last active May 23, 2019 19:47
Client for my gRPC server(ブログ公開用) https://nekonenene.hatenablog.com/entry/2019/02/17/073806
package main
import (
"context"
"go/build"
"log"
"os"
"strconv"
"time"
@nekonenene
nekonenene / client01.go
Last active May 23, 2019 19:47
Client for my gRPC server(ブログ公開用) https://nekonenene.hatenablog.com/entry/grpc-nginx-proxy
package main
import (
"context"
"crypto/tls"
"log"
"os"
"strconv"
"time"