Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Hatena Haiku notify auto opener
// @namespace http://www.hatena.ne.jp/Nikola/
// @description はてなハイク1.1の新着通知を自動で開きます。Google Chromeにも対応。
// @include http://h1beta.hatena.ne.jp/*
// @include http://h1beta.hatena.com/*
// ==/UserScript==
(function () {
// ==UserScript==
// @name replace star by profile icon
// @namespace http://www.hatena.ne.jp/Nikola/
// @description replace star by profile icon (for Google Chrome8)
// @include http://*.hatena.ne.jp/*
// @version 1.0.0
// ==/UserScript==
(function () {
var executeBrowserContext = function(funcOrString) {
@nikolat
nikolat / aaa.txt
Created January 8, 2011 14:13 — forked from fumokmm/aaa.txt
aaa
def array = []
def tmp = ""
array = ('0'..'9') + ('a'..'z') + ('A'..'Z') + '_'
(1..16).each {
tmp += array[Math.floor(Math.random() * array.size()) as int]
}
println tmp
@nikolat
nikolat / transparent_png.php
Created February 13, 2011 15:40
PNGの左上(x,y)=(0,0)のドットの色全て透過する
<?php
if (!isset($_GET['image_url'])) {
header('HTTP/1.0 400 Bad Request');
header('Content-type: text/plain; charset=utf-8');
exit('Set "image_url" parameter with PNG image URL.');
}
$fileurl = $_GET['image_url'];
$image = @imagecreatefrompng($fileurl);
if (!$image) {
header('HTTP/1.0 500 Internal Server Error');
@nikolat
nikolat / ayasaori.aym
Last active October 8, 2021 05:05
YAYA as SAORI
// https://gist.github.com/nikolat/1007538
// yaya.dll設定
#globaldefine AYAINFO_VERSION 0
#globaldefine AYAINFO_CHARSET 1
#globaldefine AYAINFO_PATH 2
#define PROTOCOL_VERSION "1.0" /* SAORIプロトコルバージョン */
#define PROTOCOL_SENDER "AYASAORI" /* Sender */
#define CRLF CHR(0xd)+CHR(0xa) /* 改行コード */
@nikolat
nikolat / usage.txt
Created June 27, 2011 13:52
Call PLUGIN from YAYA
USAGE1
{
void PLUGIN('SAKNIFE\SAKNIFE.DLL', 'OnSwissArmyKnifeExecute', 'empty_recycle_bin')
}
USAGE2
{
PLUGIN('BeerShower\yaya.dll', 'OnMenuExec')
// valueex[0]: OnBeerShower
}
@nikolat
nikolat / cafetter-brunch.user.js
Created August 9, 2011 11:06
userscript for cafetter
// ==UserScript==
// @name cafetter brunch
// @namespace http://www.hatena.ne.jp/Nikola/
// @description add class for cafetter timeline, enable tweet with no script
// @version 1.0.4
// @include http://cafetter.com/*
// ==/UserScript==
(function(d) {
function setClassToTweets(d) {
var targets = d.querySelectorAll('.timeline li');
@nikolat
nikolat / fizzBuzzN.groovy
Created August 18, 2011 14:09 — forked from fumokmm/fizzBuzzN.groovy
お題:FizzBuzz(Nパターン) solved by Groovy
// http://d.hatena.ne.jp/fumokmm/20110815/1313405510
def fizzBuzzN(nums, list) {
def toMap = { lst -> (0..<lst.size()/2).collectEntries{ lst[it*2..it*2+1] } }
toMap(list).collect{ k, v ->
v = nums.collect{ it % k == 0 ? v : '' }
}.transpose()*.join().eachWithIndex{ it, idx ->
println(it ? it : idx+nums.from)
}
}
fizzBuzzN(1..100, [3, 'Fizz', 5, 'Buzz', 7, 'Hoge'])
@nikolat
nikolat / dropStartsSameTest.groovy
Created August 20, 2011 02:17 — forked from fumokmm/dropStartsSameTest.groovy
お題:文字列を先頭から見て同じところまで除去
// http://d.hatena.ne.jp/fumokmm/20110812/1313138407
def dropStartsSame(String... args) {
if (args.any{!it}) return args
args*.substring(
args*.toList().transpose().with{
def i=0; it.collect{[i++, it]}
}.with{ dup ->
dup.find{ it[1].unique().size() != 1 }.with {
it ? it[0] : dup.last()[0]+1
}