Skip to content

Instantly share code, notes, and snippets.

View yswallow's full-sized avatar

Sanagi yswallow

View GitHub Profile
@yswallow
yswallow / qualityfilter.md
Created April 11, 2017 10:14
quality-filter プラギンの要件

見たくないツイ

  • 長い
    • 長いのに改行がない
  • URLを含まない
@yswallow
yswallow / tl_wave.rb
Last active April 12, 2017 11:42
地震で流速が早くなるとmikutterちゃんが教えてくれます
# -*- coding: utf-8 -*-
Plugin.create(:tl_wave) do
words = ['ゆ', 'yu', 'ゆれ', 'yure', 'yureda', '#筑波大学は核実験をやめろ']
expire = Time.now
short_tweets = []
words_matched_tweets = []
on_update do |service, messages|
@yswallow
yswallow / pitagorasu.s
Created March 6, 2017 08:00
アセンブリでピタゴラス数を探して表示する
.data
s: .string "%d^2 = %d^2+%d^2\n"
ers: .string "ERROR\neax=0x%x, ebx=0x%x, ecx=0x%x, edx=0x%x\n"
.text
.globl main
main:
init:
push %ebp
mov %esp, %ebp
@yswallow
yswallow / check.rb
Created February 8, 2017 07:45
TreeScript1.javaの出力が正しいか確認するやつ
scripts_ans = [
['( + 3 8 )', 11],
['( + 5 ( * 3 7 ) )', 26],
['3', 3],
['abc', 'abc'],
['( call ( fun square ( call square 3 ) ) ( fun x ( * x x ) ) )', 9],
['( call ( call ( fun x ( fun y ( / ( + x y ) 2 ) ) ) 5 ) 9 )', 7],
['( == ( + 1 1 ) 2 )', '( fun left ( fun right left ) )'],
['( == ( + 1 1 ) 0 )', '( fun left ( fun right right ) )'],
['( call ( call ( == 1 1 ) ( * 3 3 ) ) ( * 5 5 ) )', 9],
@yswallow
yswallow / nopuee.rb
Created February 5, 2017 14:35
ぷえー言うな!! (mikutterプラグイン)
Plugin.create :NopuA do
#regex = /(ぷ|ふ゜)[\s\n]*[えぇゑ][\s\n]*([ー〜―−]|\s[\||])/
regex = /(ぷ|ふ゜)[^[:word:]]*[えぇゑ]/
on_appear do |ms|
ms.each do |m|
body = m.body
unless m.retweet? || /[言い]うな/ =~ body
if regex =~ body
if m[:created] > Time.now - 5 #5秒以前のツイートにはリプライしない
m.post( message: "@#{ m.user.idname } #{$&}言うな!! (自動ツイート)" )
@yswallow
yswallow / fuckinmaker.rb
Created January 27, 2017 13:50
あ❗️毎日風呂に入れ(@y_sni)❗️🌚ダン💥ダン💥ダン💥シャーン🎶すに🌝すに🌚すに🌝すに🌚すに 🌝すに🌚す〜〜〜に⤴🌝すに🌚すに🌝すに🌚すに🌝すに🌚すに🌝す〜〜〜に⤵🌞#ダンスーモの「ス」,「モ」を置換したやつを一般的に作る
# -*- coding: utf-8 -*-
module FuckinMaker
def column(target = '')
hbox = Gtk::HBox.new( true, 0 )
hbox.pack_start(Gtk::Label.new(target), false, false, 0 )
entry = Gtk::Entry.new
entry.text = target
hbox.pack_start(entry, false, false, 0)
return [hbox, entry]
@yswallow
yswallow / tl_speed.rb
Last active April 11, 2017 09:44
HomeTimelineの流速をmikutterのステータスバーに表示するやつ
# -*- coding: utf-8 -*-
Plugin.create(:tl_speed) do
home_tl = Plugin[:gtk].widgetof(timeline(:home_timeline))
count = 0
on_update do |service, messages|
home_tl ||= Plugin.create(:gtk).widgetof(timeline(:home_timeline))
time = Time.now
count = 0
(home_tl || []).each_with_index do |message,i|
@yswallow
yswallow / str-t-str.rb
Created November 22, 2016 05:31
カップリングの戦闘力を計算する(危険)
class String
def sentouryoku
return self.each_byte.to_a.inject(0) { |sum,i| sum*256 + i }
end
def *(otr)
return self.sentouryoku * otr.to_s.sentouryoku
end
end
@yswallow
yswallow / reader.c
Last active March 23, 2018 06:17
RubyとC言語でTab区切りのCSVっぽいのを配列に読み込む比較
fp = fopen(argv[1], "r");
if(! fp)
{
printf("can't open %s\n", argv[1]);
return 1;
}
i = 0;
mode = 0; /* 0=>name, 1=>point */
while ((ch = fgetc(fp)) != EOF) {
@yswallow
yswallow / fav2u.rb
Created October 20, 2016 14:46
@toshi_a の全ツイふぁぼってやる
Plugin.create :fav2u do
count = 0
onappear do |ms|
ms.each do |m|
user = m.user
if m.user.to_s == 'toshi_a'
m.message.favorite(true)
count += 1
puts 'ふぁぼった ' + count.to_s
end