Skip to content

Instantly share code, notes, and snippets.

@tyoro
tyoro / カレンダーの予定作成日を調べるマン
Last active June 22, 2021 00:35
GAS でカレンダーの予定作成日時を調べるやつ
function myFunction() {
var e = getEvents(2019,5,18);
for(var i = 0; i < e.length; i++){
var text = e[i].getTitle() + " : " + e[i].getDateCreated();
Logger.log(text);
}
}
function getEvents(y,m,d){
var cal = getCalendar(); // カレンダーの取得
@tyoro
tyoro / bot_simple.js
Created December 20, 2018 17:15
discord の VC への join を google home で通知するシンプルな nodejs
const Eris = require('eris');
const googlehome = require('google-home-notifier')
var deviceName = 'Google Home';
var deviceIP = '192.168.x.x'; // default IP
var language = 'ja'; // default language code
googlehome.ip(deviceIP, language);
googlehome.device(deviceName,language);
@tyoro
tyoro / main.go
Created December 20, 2018 14:51
Disocrd の VC の入室を Google Home から通知する bot
package main
import (
"fmt"
"github.com/bwmarrin/discordgo"
"log"
"net/http"
"net/url"
)
@tyoro
tyoro / 距離はかるマン
Created September 26, 2018 10:15
app script 用の距離はかるやつ
function myFunction() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
var sheet = spreadsheet.getActiveSheet();
const startRow = 2
const lastRow = sheet.getLastRow() - 1
const dataRange = sheet.getRange(startRow, 1, lastRow, 3);
const data = dataRange.getValues();
for (var i = 0; i < data.length; ++i) {
" 文字コードの自動認識
if &encoding !=# 'utf-8'
set encoding=japan
set fileencoding=japan
endif
if has('iconv')
let s:enc_euc = 'euc-jp'
let s:enc_jis = 'iso-2022-jp'
" iconvがeucJP-msに対応しているかをチェック
if iconv("\x87\x64\x87\x6a", 'cp932', 'eucjp-ms') ==# "\xad\xc5\xad\xcb"
@tyoro
tyoro / 22001x.user.js
Created March 14, 2012 15:10
LDR Ad-Entry Blocker for Chrome
(function(){
location.href= "javascript:function $x(x,c){c=c||document;var res=document.evaluate(x,c,null,4,null);for(var i,nodes=[];i=res.iterateNext();nodes.push(i));return nodes;}; var cfg = { patterns: [/^[\s【]*(AD|PR|AD|PR)[\s】]*[::]/i],style: {color: '#aaa', fontSize: '12px' }, interval: 1000, skip: true}; LDR.register_hook('AFTER_PRINTFEED', function() { var hist = []; var isComp = function(){ var len = hist.length; if(len < 3) return false; return hist[len-1] == hist[len-2] && hist[len-2] == hist[len-3]; }; var blocker = function(){ var titles = $x('//h2[@class=\"item_title\"]/a'); hist.push(titles.length); for(var i = 0; i < titles.length; i++){ var title = titles[i]; for(var j = 0; j < cfg.patterns.length; j++){ if((new RegExp(cfg.patterns[j])).test(title.innerHTML)){ setStyle(title, cfg.style); addClass(title.parentNode, 'laeb_blocked'); var childs = title.parentNode.parentNode.parentNode.childNodes; for(var k = 0; k < childs.length; k++){ if(childs[k].nodeType !== 1 || hasClass(childs[k], 'item_he
@tyoro
tyoro / dao.php.part
Created January 17, 2012 09:43
tiarraMetroの初回ロードのクロスクエリを廃止して、メモリサイズオーバー対策の為に個別にループ化したもの
function getUnreadList( $server = "", $sort = 0 ){
$sql = "SELECT
channel.id,
channel.name,
substring(channel.name, locate('@', channel.name) + 1) as network
FROM channel
WHERE view = ?";
$values = array(1);
if( !empty($server) ){
@tyoro
tyoro / DBI.pm
Created September 30, 2011 14:23
tiarra Log::DBI.pm に設定項目を追加してチャンネルmaskしてマッチしたものだけ通すようにした。+ privはprivテーブルに流しこむようにしたり何や色々。
package Log::DBI;
use strict;
use warnings;
use IO::File;
use File::Spec;
use Tiarra::Encoding;
use base qw(Module);
use Module::Use qw(Tools::DateConvert Log::Logger Log::Writer);
use Tools::DateConvert;
use Log::Logger;