Skip to content

Instantly share code, notes, and snippets.

View pnlybubbles's full-sized avatar
🍋
is delicious!

pnly pnlybubbles

🍋
is delicious!
View GitHub Profile
@pnlybubbles
pnlybubbles / bot-2-sample.rb
Last active August 29, 2015 13:55
TwitterBotを簡単につくるためのやつ。TwitterGem必要。
# encoding: utf-8
$VERBOSE = nil # instead of -W0
require_relative "./bot-2.rb"
# CONSUMER_KEY = ""
# CONSUMER_SECRET = ""
# ACCESS_TOKEN = ""
# ACCESS_TOKEN_SECRET = ""
@pnlybubbles
pnlybubbles / pm1.rb
Created January 30, 2014 13:31
素因数分解するやつ。"ruby pm1.rb 12345678987654321"
# encoding: utf-8
def powm(base, power, mod)
ret = 1
until power == 0
ret = ret * base % mod if power & 1 == 1
base = base * base % mod
power >>= 1
end
ret
@pnlybubbles
pnlybubbles / bot-2-main.rb
Last active August 29, 2015 13:55
わたしのメイドちゃん
# encoding: utf-8
Encoding.default_external = Encoding::UTF_8
$VERBOSE = nil # instead of -W0
require "timeout"
require "date"
require "cgi"
# require "pry"
# require_relative "./wac/lib/wac.rb"
@pnlybubbles
pnlybubbles / 2015_sheep_quine.rb
Created January 1, 2015 14:27
なもり先生の2015年アイコンQuine.
eval$s=%w'b="BAhsKwJ+Af////////////////////////////////////////////////////////////////////////////////////////
/////////////////4////////////////H/z//////////38AAP4BwP//////////BwABEPAH+P////////vh/w8A/h/8////////Af7/f4T/H
/7//////weA////wx88/v////9/AP/////Bzzz+/////x/4/////+Dnj///////A/z///9/4IfD//////8B/////z/AD8D/////APD//////4f/
AP///38A/P//////AwCA////BwD+//////8BAAb////gH/7////////7j///f/wf/v///y/+//mP//8f/x//////B////8f//8PPj/////+A///
/o///88HH////P8D///nR/9945uP/////////P/z/b/zz+f/5//////8f/v8//nz4P/j//////4/+/z8+Hv4f8P8f/P//wP//D8CD/w/+/w/+//
/D//8/cPj////3B////+P//x8A/////wOA////8///D8D////BAcD////x////8f///wAA////3/z //3/w////AeD///8f/v//f/j///+H//
///wf///8//P//////////gP///y/6/////////w8A8P//P/j/////////BwD4//9/8P/////// /+DAfz//38A/v///////+EB/v///wf/
//////9//P//////w////////w/+//////+H////////wP ///////w f+/////wHg////////DwDw/88v
AMD///////9/APj/hwcH4P////////8B4H8A8A/w/// / / ///fwAA AAD+D/z///////8f4L/w
AP///////////x/w
@pnlybubbles
pnlybubbles / update_name.rb
Last active August 29, 2015 14:13
Minecarftの中でもupdate_nameしたい。プレーヤーの表示名を変えれるBukkitプラグイン。Puruginを利用。
# encoding: utf-8
class UpdateNamePlugin
include Purugin::Plugin
description 'UpdateName', 0.1
def on_enable
chatcolor = org::bukkit::ChatColor
public_command('update_name', 'change displayed name', '/update_name {id} {new_name}') do |sender, *args|
@pnlybubbles
pnlybubbles / factorization.rb
Created January 25, 2015 06:32
メイドちゃんの素因数分解のとこだけ抜き出したもの
def powm(base, power, mod)
ret = 1
until power == 0
ret = ret * base % mod if power & 1 == 1
base = base * base % mod
power >>= 1
end
ret
end
@pnlybubbles
pnlybubbles / closure.coffee
Last active August 29, 2015 14:22
CoffeeScriptでクロージャのテスト
class Runner
constructor: ->
@cbs = []
set: (callback) ->
@cbs.push callback
run: ->
for cb in @cbs
cb()
@pnlybubbles
pnlybubbles / app.rb
Created July 25, 2015 05:27
形態素解析と特徴分析を適当にやってみた。学習データはtwitterから。
require 'natto'
require 'twitter'
require 'yaml'
key_data = YAML.load_file(File.expand_path('./key_token.yml'))
$api = Twitter::REST::Client.new do |config|
config.consumer_key = key_data['consumer_key']
config.consumer_secret = key_data['consumer_secret']
config.access_token = key_data['access_token']
@pnlybubbles
pnlybubbles / puyo_solver.rb
Last active September 23, 2015 05:51
ぷよクエの最適解探索を行うプログラム。ぷよクエのスクショから譜面を自動読み込みする機能も付けた。並列処理対応。まだ分岐を含む斜めの消し方(一度通ったぷよを再び通るなぞり方)には対応していない。
require 'highline'
require 'rmagick'
require 'parallel'
require 'pp'
class ImageAnalize
attr_reader :img
COLOR_MAP = [
nil,
@pnlybubbles
pnlybubbles / gulpfile.coffee
Created October 1, 2015 12:31
よく使うgulpfileのメモ
gulp = require 'gulp'
watchify = require 'gulp-watchify'
sourcemaps = require 'gulp-sourcemaps'
buffer = require 'vinyl-buffer'
plumber = require 'gulp-plumber'
rename = require 'gulp-rename'
target =
src: 'index.coffee'
name: 'index.js'