Skip to content

Instantly share code, notes, and snippets.

View moyashipan's full-sized avatar
👀

moyashipan moyashipan

👀
  • pixiv Inc.
  • Yoyogi Shibuya-ku Tokyo Japan
View GitHub Profile
@moyashipan
moyashipan / alexa_post.ino
Created November 23, 2020 07:54
測距センサーをつないだM5ATOM MatrixからAlexaのChangeReportを送る
String regenerateAccessToken() {
String payload = "";
payload += "grant_type=refresh_token";
payload += "&refresh_token=" + REFRESH_TOKEN;
payload += "&client_id=amzn1.application-...";
payload += "&client_secret=...";
HTTPClient client;
client.begin("https://api.amazon.com/auth/o2/token");
client.addHeader("Content-Type", "application/x-www-form-urlencoded");
@moyashipan
moyashipan / GoogleMeetGetWild.js
Last active September 11, 2020 14:38
Google Meetの終了時間2分前にGet Wildを自分の画面上に表示するやつ。
// Meetに参加したら、以下すべてをChromeのConsole(Option + Command + i)にコピペしてEnterを押してください。
// 起動が成功するとミーティングの詳細(左下のやつ)が一瞬開いて閉じます。
// カレンダーと紐付いた(終了時刻のある)Meetなら、終了時刻の2分前にあなたの画面上にだけGet WildのYouTube動画が表示されます。
// ただし毎回この操作をする必要があって面倒。
// なのでChrome Extensionにしたり改変したりはご自由にどうぞ。
(async () => {
function findButton(expanded) {
return document.querySelector(`[aria-haspopup="true"][aria-label$="の詳細"][aria-expanded=${expanded}]`);
}
@moyashipan
moyashipan / auto_hot_carpet.ino
Last active February 13, 2020 16:27
距離センサーでホットカーペット上に猫がいるのを検知してIFTTTにトリガーするやつ
#include <HTTPClient.h>
const char SSID[] = "YOUR_WIFI_SSID";
const char PASSWORD[] = "YOUR_WIFI_PASSWORD";
const char IFTTT_WEBHOOK_URL_ON[] = "https://maker.ifttt.com/trigger/cat_bed_on/with/key/***************_******";
const char IFTTT_WEBHOOK_URL_OFF[] = "https://maker.ifttt.com/trigger/cat_bed_out/with/key/***************_******";
const int RECV_PIN = 34;
const int LED_PIN = 2;
const int AVE_LENGTH = 100;
@moyashipan
moyashipan / m5stickc_book_mekuri.ino
Created January 18, 2020 21:55
M5StickCで布団から手を出さずに読書アプリのページをめくるやつ
#include <M5StickC.h>
// https://github.com/T-vK/ESP32-BLE-Keyboard
#include <BleKeyboard.h>
BleKeyboard bleKeyboard;
bool connected = false;
struct KeyConfig {
String name;
String example;
@moyashipan
moyashipan / yml.vim
Last active August 29, 2015 14:00
PwdYaml
" .vim/autoload/yml.vim
function! yml#search(pos)
let indent = indent(a:pos)
let keys = [s:get_key(getline(a:pos))]
for n in range(line(a:pos), 1, -1)
if indent(n) == (indent - &tabstop)
call insert(keys, s:get_key(getline(n)))
let indent = indent - &tabstop
endif
/*
javascript:(function(){var s,d,u='//gist.github.com/moyashipan/6409832/raw/main.js'; d=document;s=d.createElement('script');s.setAttribute('src',u);d.documentElement.appendChild(s);}())
*/
(function(){
var u = 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js';
var d = document;
var s = d.createElement('script');
s.setAttribute('src', u);
d.documentElement.appendChild(s);
var clearId = setInterval(function(){
@moyashipan
moyashipan / main.js
Last active December 22, 2015 03:19
Template of bookmarklet with jQuery
/*
javascript:(function(){var s,d,u='//gist.github.com/moyashipan/6409832/raw/main.js'; d=document;s=d.createElement('script');s.setAttribute('src',u);d.documentElement.appendChild(s);}())
*/
(function(){
var u = 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js';
var d = document;
var s = d.createElement('script');
s.setAttribute('src', u);
d.documentElement.appendChild(s);
var clearId = setInterval(function(){
@moyashipan
moyashipan / GoogleAppsScript.js
Created August 23, 2013 09:30
Gmailからタイトルと日付で検索した結果を、GoogleSpreadSheetに流し込みます
function searchAndSave() {
var sheet = SpreadsheetApp.getActiveSheet();
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var offset = 0;
var limit = 500;
while (true) {
var threads = GmailApp.search('(subject:日報 AND [report) after:2013/5/31 before:2013/7/1', offset, limit);
offset += limit;
@moyashipan
moyashipan / gist:5699526
Last active December 18, 2015 00:49
Patch for Chrome (ver. 27.0.1453.94 m) Bug. Cannot draw a 1px-width line on CANVAS.
// See: http://www.pixiv.net/group/comment.php?id=747934
pixiv.ui.DrawrPainter.prototype.widthList = [0.9, 2, 4, 6, 10, 15, 30];
alert("pixivグループお絵描きツールの\n一番細い線を0.9pxに設定しました");
@moyashipan
moyashipan / gist:5641292
Last active December 17, 2015 16:49
ピクシブオフィスで休日に開催される勉強会向けの説明文です
◯場所
〒151-0051 東京都渋谷区千駄ヶ谷4丁目23-5 JPR千駄ヶ谷ビル 5F ピクシブ株式会社
http://p.tl/RwHh
◯定員
24名
◯入退場について
当日は正面玄関が使えません。
入場の際にはビル左奥の通用口インターホンで呼びかけてください。