Skip to content

Instantly share code, notes, and snippets.

View koni's full-sized avatar
🏠
Working from home

koni koni

🏠
Working from home
View GitHub Profile
@koni
koni / gist:da3e76046232b6391467088b2f73afdd
Created May 16, 2018 07:50
GAS 適当なスプレッドシートにjsonの結果を書き込む
function myFunction() {
var sheet = SpreadsheetApp.getActiveSheet();
for (var i in users.users){
var user = users.users[i];
var r= parseInt(i, 10)+2;
sheet.getRange(r, 1).setValue(user.screen_name);
sheet.getRange(r, 2).setValue(user.name);
sheet.getRange(r, 3).setValue(user.protected);
}
@koni
koni / gist:6e564852c2b1b806070a37b42c37f281
Last active May 14, 2018 05:07
ランディングページのURLを記録してSocialDogのURLを書き換える
<script type="text/javascript">
// ランディングページのパスをCookieに記録し、URLを置換する
document.addEventListener('DOMContentLoaded', function(){
var val = document.cookie.replace(/(?:(?:^|.*;\s*)sd_lp_path\s*\=\s*([^;]*).*$)|^.*$/, "$1");
var new_val = "http://blog.whotwi.com" + document.location.pathname;
if (!val) {
document.cookie="sd_lp_path=" + new_val + "; path=/;max-age=36000";
}
var utm_campaign = (val ? val + '__' + new_val : new_val);
var new_url = "https://social-dog.net/?utm_source=blog&utm_medium=web&utm_campaign=" + encodeURIComponent(utm_campaign);
@koni
koni / gist:b373eb13f1848ab5d7bbcd303242d3c7
Created March 7, 2018 03:41
DiskUsageを閾値を超えたらSlack Webhookでチャンネルに通知.sh
#!/bin/sh
DVAL=`/bin/df / | /usr/bin/tail -1 | /bin/sed 's/^.* \([0-9]*\)%.*$/\1/'`
if [ $DVAL -gt 80 ]; then
curl -s -S -X POST --data-urlencode "payload={\"channel\": \"alert\", \"username\": \"web.social-dog.net\", \"icon_emoji\": \":warning:\", \"text\": \"Disk Usage $DVAL%\" }" [webhook URL] >/dev/null
fi
@koni
koni / Brewfile
Last active August 29, 2015 13:58 — forked from evalphobia/Brewfile
update
upgrade
tap homebrew/versions
# install homebrew-cask
tap phinze/homebrew-cask
install brew-cask
# install with homebrew
@koni
koni / gist:1277218
Created October 11, 2011 03:44
whotwi en.po
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
@koni
koni / gist:1074418
Created July 10, 2011 09:44
curlによる並列アクセスサンプル.php
<?php
$start=microtime()+time();
define("COUNT_OF_PAGES",3);
$mh = curl_multi_init();
$ch=array();
$data=array();
for($i=1;$i<=COUNT_OF_PAGES;$i++){
@koni
koni / gist:1074379
Created July 10, 2011 08:31
ブログすぐ表示するやつ.php
//ブログ
$cache_file_name="/tmp/index_blog";
if(file_exists($cache_file_name) && time()-filemtime($cache_file_name)<43200 ){
$blog=unserialize(file_get_contents($cache_file_name));
}else{
$data=simplexml_load_file("http://d.hatena.ne.jp/konisimple/searchdiary?word=%2A%5Bwhotwi%5D&mode=rss");
$blog=array();
foreach($data->item as $item){
$blog[]=array(
"title"=>preg_replace("/\[(.+)\]/","",(String)$item->title),
@koni
koni / gist:823625
Created February 12, 2011 08:51
emr処理
Sub go()
Dim cue_count As Integer
Dim eyerecord_count As Long
Dim cue_min(0 To 50) As Long
Dim cue_max(0 To 50) As Long
Dim eyerecord_val As Long
Dim tmp(0 To 10) As Integer
' Responseシート読み込み
Worksheets("Response").Activate
cue_count = 2
// 使い方
// 検索結果ページで以下をアドレスバーにコピーアンドペースする。
// javascript:(function(){d=document;s=d.createElement('script');s.setAttribute('src','https://gist.github.com/raw/775903/replacingCollection.js');d.documentElement.appendChild(s);}())
document.body.appendChild((function(){
var s = document.createElement("script");
s.type = "text/javascript";
s.src = "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
s.onload = function() {
window.jQuery.noConflict();
第2回「東京六大学ハイク」を開催のお知らせ(締切迫る)【早稲田大学学生生活課】
2010年10月5日
サークル幹部 各位
早稲田大学学生生活課
第2回「東京六大学ハイク」を開催のお知らせ(締切迫る)
早稲田大学では、体育祭・総長杯スポーツ大会の一種目して、慶應義塾大学の三田キャ