Skip to content

Instantly share code, notes, and snippets.

View TwoSquirrels's full-sized avatar

りすりす/TwoSquirrels TwoSquirrels

View GitHub Profile
@TwoSquirrels
TwoSquirrels / template.ejs
Last active August 18, 2021 13:20
HTMLのテンプレート(ejs)
<%#
projectName: プロジェクト名
fileName: ファイル名
author: ページの作者
license:
name: オープンソースライセンス名(MIT,Apache-2.0,etc)
url: オープンソースライセンスのURL
type: ページの種類(普通はwebsite,記事はarticle,etc)
keywords: キーワードの配列(OGPには影響しないとされているがタグとして設定しておこう)
description: ページの説明
@TwoSquirrels
TwoSquirrels / gas.js
Last active December 29, 2022 14:38
GASでのAPI
/* server.gs */
function doPost(req) { // req.parameterでクエリが手に入るぞ!
// request (reqBodyにリクエストデータが入ってくるぞ!ただしXMLも受け取りたいときは場合分けが必要だから注意な!あ、doGetの時はこれ要らんからな。)
let reqBody;
try {
reqBody = JSON.parse(req.postData.getDataAsString());
} catch(e) {
return ContentService.createTextOutput(
@TwoSquirrels
TwoSquirrels / ゲーミング背景.md
Last active February 1, 2022 01:52
[BookMarkLet] Rainbow Background

Rainbow Background Bookmarklet

Version 3

  • Double-click to exit.
  • Shorter than v2. (810 -> 561)
javascript:((r,a,s,p,b,e,n)=>{let w=window,l=e("body").classList,x=c=>l.remove(c);if(!e("#"+r+s))e("head").innerHTML+=`<style id="${r+s}">@keyframes ${r}-${a}{${[0,1,2,3,4,5,6].map(i=>i/0.06+"%{background-color:#"+"c44c44cc4cc4c".substr(i%2*5+i%6,3)+"}").join("")}}.${r}{${a}:${r}-${a} 15s linear 0s infinite normal}.${r+p}{${a}-play-state:paused}</style>`;if(l.contains(r)){if(w[r][b]+500>=n){x(r);x(r+p)}else{l.toggle(r+p);w[r][b]=n}}else{l.add(r);w[r]={before:0}}})("rainbowbg3","animation","-style","-pause","before",q=>document.querySelector(q),Date.now())
function geek14() {
const strIS = "HIJKLMNOPQRS";
const monthColSize = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
["最高気温", "最低気温"].forEach((name) => {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(name);
let monthCol = 9;
for (let m = 1; m <= 12; ++m) {
for (let row = 2; row < 7; ++row) {
sheet
.getRange(strIS[m - 1] + row)
@TwoSquirrels
TwoSquirrels / googleform-viewscore-hidedisturbing-v1.md
Last active December 15, 2021 09:24
[BookMarkLet] GoogleForm ViewScore HideDisturbing

GoogleFormのスコア表示で邪魔な選択肢を隠すブックマークレット

Version 1

トグル可能

javascript:((n,s,l,t)=>{window[n]??={};[...document.getElementsByClassName(s+"Choice")].forEach(c=>c.style.setProperty("display",(window[n].h||c[l][t](s+"Selected")||c.parentElement[l][t](s+"CorrectAnswerBox"))?"":"none"));window[n].h^=1})("googleform-viewscore-hidedisturbing-v1","freebirdFormviewerViewItemsSelect","classList","contains")
@TwoSquirrels
TwoSquirrels / Main.cc
Last active September 30, 2023 16:07
AtCoder Template - by TwoSquirrels
#if true
//{{{
// ============================== MY TEMPLATE ============================== //
// author : @TwoSquirrels (https://github.com/TwoSquirrels)
// latest ver : https://gist.github.com/TwoSquirrels/79992561b48f61cbae72815231b57378
// license : MIT License
// optimize for gcc
#pragma GCC target("avx")
#pragma GCC optimize("O3")
/*
* 経験値計算
* @author TwoSquirrels
*/
// レベルアップに必要な経験値は (level*level+a)*b とする(つまり二次関数)
// ここでは a=2,B=10 としとく
const a = 2, b = 10;
const expToLevelUp = (level) => (level * level + a) + b;
// するとレベルまでに必要な総合経験値は (((level-1)*level*(level*2+1)/6)+level*a)*b となる(二乗の和の公式を利用<-これ数B範囲)
@TwoSquirrels
TwoSquirrels / wandbox-api-test-2.js
Last active March 24, 2022 10:59
testing Wandbox API
const http2 = require("http2");
function fetchUrl(url, { method, contentType, body, events }) {
return new Promise((resolve, reject) => {
try {
const jsUrl = new URL(url);
const bodyBuffer =
body === undefined ? undefined : Buffer.from(JSON.stringify(body));
const client = http2.connect(jsUrl.origin);
@TwoSquirrels
TwoSquirrels / .bash_aliases
Created May 14, 2022 05:38
My Termux dotfiles
#!/data/data/com.termux/files/usr/bin/bash
# ls
alias la="ls -A"
alias ll="ls -Alh"
alias l="ls"
# mkdir
alias mkdir="mkdir -p"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.