Skip to content

Instantly share code, notes, and snippets.

View spotifyPlaylistSync.js
function myFunction() {
const sheet = SpreadsheetApp.getActive().getActiveSheet();
const client_id = sheet.getRange("B1").getValue();
const client_secret = sheet.getRange("D1").getValue();
const f1 = sheet.getRange("F1").getValue();
const playlist_id = f1.startsWith("https://open.spotify.com/") ? f1.slice(34, f1.indexOf('?')) : f1;
const keytuple = client_id + ":" + client_secret;
const client64 = Utilities.base64Encode(keytuple, Utilities.Charset.UTF_8);
View .vimrc
"-=-=-=-=-=-=-=-=-=-=--"
" .vimrc "
" created by thotgamma "
" https://gammalab.net "
"-=-=-=-=-=-=-=-=-=-=-="
" プラグイン管理ツールとしてdein.vimを使う。
" ### 定数等の設定
@thotgamma
thotgamma / lambda_function.py
Created Feb 16, 2021
Amplifyのビルド通知をDiscordに送るLambda(Python)
View lambda_function.py
from __future__ import print_function
import urllib.request
import json
print('Loading function')
# == :: 設定項目 :: ===========================================
endpoint = "https://discord.com/api/webhooks/YOURENDPOINT-URL"
accountName = 'YOUR ACCOUNT NAME'
accountImage = 'YOUR ACCOUNT IMAGE URL'
@thotgamma
thotgamma / test.json
Created Feb 15, 2021
AWS Cloud-Watch Alarm Event via SNS
View test.json
{
"Records":[
{
"EventSource":"aws:sns",
"EventVersion":"1.0",
"EventSubscriptionArn":"arn:aws:sns:ap-northeast-1:<省略>",
"Sns":{
"Type":"Notification",
"MessageId":"<省略 なんかID>",
"TopicArn":"arn:aws:sns:ap-northeast-1:<省略>",
@thotgamma
thotgamma / hls_stream.h
Created Aug 17, 2020
vivadoHLSのstreamを検証用に簡易的に実装したものです
View hls_stream.h
#include <stdio.h>
#include <queue>
namespace hls {
template <typename T>
class stream {
const char* name;
std::queue<T> queue;
View geojson.php
<?php
$todofuken=array(
'北海道'=>'hokkaido',
'青森県'=>'aomori',
'岩手県'=>'iwate',
'宮城県'=>'miyagi',
'秋田県'=>'akita',
'山形県'=>'yamagata',
'福島県'=>'fukushima',
View gist:d678d806925d66d11f9f409c15b4e72b
mat_coo_t* create_coo_from_mmfile(const char* filename) {
MTR_BEGIN_FUNC();
const int BufferSize = 1024;
FILE* fp = fopen(filename, "r");
char line[BufferSize];
int state = 0; //0: size, else: content
mat_coo_t* coo;
int itr = 0;
View vimrc.vim
"-=-=-=-=-=-=-=-=-=-=--"
" .vimrc "
" created by thotgamma "
" https://gammalab.net "
"-=-=-=-=-=-=-=-=-=-=-="
" プラグイン管理ツールとしてdein.vimを使う。
" ### 定数等の設定
@thotgamma
thotgamma / main.c
Created Aug 27, 2018
use MCP4922 with pic18f4553
View main.c
/*
* File: main.c
* Author: thotgamma
*
* Created on August 4, 2018, 4:31 AM
*/
#pragma config FOSC = HS // 20MHz Xtal(分周なし)
#pragma config MCLRE = ON // リセットピンを利用する
#pragma config LVP = OFF // 低電圧プログラミング機能使用しない(OFF)
@thotgamma
thotgamma / sample.cpp
Created Feb 20, 2018
simple tile texture
View sample.cpp
uint8_t mytex[3*256*256];
for (int i = 0; i < 256; i++) {
for (int j = 0; j < 256; j++) {
bool flagA = (i % 32) < 16;
bool flagB = (j % 32) < 16;
if (flagA ^ flagB) {
mytex[3*(i+256*j)+0] = 32;
mytex[3*(i+256*j)+1] = 33;