Skip to content

Instantly share code, notes, and snippets.

@hyuki0000
hyuki0000 / error.txt
Created June 18, 2017 13:08
Mastodon 1.3.3 -> 1.4.3 でエラー
$ docker-compose pull
$ docker-compose build
$ docker-compose run --rm web rails db:migrate
$ docker-compose run --rm web rails mastodon:maintenance:prepare_for_foreign_keys
$ docker-compose run --rm web rails db:migrate
$ docker-compose run --rm web rails assets:precompile
Creating mastodon user (UID : 1000 and GID : 1000)...
Updating permissions...
Executing process...
yarn install v0.24.5
@hyuki0000
hyuki0000 / TipmonaTipBookmarklet.js
Last active January 19, 2018 22:46
TipmonaTipBookmarklet.js - Pay monacoin via @tipmona
/*
* TipmonaTipBookmarklet.js
*
* When you see
* https://twitter.com/EXAMPLEUSER/...
* Then you jump to
* https://twitter.com/intent/tweet?text=@tipmona%20tip%20@EXAMPLEUSER%201%20Mona%20を贈ります。
* And when you see
* https://twitter.com/EXAMPLEUSER/status/xxxxxxxx
* Then you jump to
@hyuki0000
hyuki0000 / girlnote150.tex
Created June 2, 2017 13:56
第150回 波の広がり(後編) より https://cakes.mu/posts/12435
数列$\{a_n\}$と$\{b_n\}$を、
$$
\left\{
\begin{align*}
a_0 &= \dfrac{1}{2\pi} \int_{0}^{2\pi} f(x) \,dx \\
b_0 &= 0 \phantom{\int_{0}^{2\pi}}\\
a_n &= \dfrac{1}{\pi} \int_{0}^{2\pi} f(x)\cos nx \,dx & (n = 1,2,3,\ldots)\\
b_n &= \dfrac{1}{\pi} \int_{0}^{2\pi} f(x)\sin nx \,dx \\
\end{align*}
\right.
@hyuki0000
hyuki0000 / positive.tex
Created June 2, 2017 13:44
正の整数の分類
$n$を正の整数とする。$n$を割り切る正の整数が$1$個しかないとき、$n$を<b>単数</b>という。ちょうど$2$個あるとき、$n$を<b>素数</b>という。$3$個以上あるとき、$n$を<b>合成数</b>という。
$$
\begin{array}{|c|c|c|c|c|c|c|c|c|c}
\hline
\textbf{単数} & 1 & & & & & & & & & & \\
\hline
\textbf{素数} & & 2 & 3 & & 5 & & 7 & & & & \\
\hline
\textbf{合成数} & & & & 4 & & 6 & & 8 & 9 & 10 & \\
@hyuki0000
hyuki0000 / mov-to-gif.rb
Last active February 24, 2018 07:16
mov-to-gif - .movからanimation GIFを作る
#!/usr/bin/env ruby
require 'tmpdir'
if ARGV.length != 3
puts "mov-to-gif: Create animation GIF"
puts "Usage: mov-to-gif 1 input.mov output.gif -- normal (x1)"
puts "Usage: mov-to-gif 2 input.mov output.gif -- faster (x2)"
puts "Usage: mov-to-gif 0.5 input.mov output.gif -- slower (x0.5)"
abort
@hyuki0000
hyuki0000 / makeapp.rb
Created May 28, 2017 04:34
makeapp - スクリプトをMacのアプリケーションにする
#!/usr/bin/env ruby
# cf. http://bit.ly/2raKfLZ
# makeapp - スクリプトをMacのアプリケーションにする
if ARGV.length != 2
abort("Usage: makeapp foo.rb Foo.app")
end
scriptname = ARGV[0]
appname = ARGV[1]
@hyuki0000
hyuki0000 / transpoint.rb
Created May 27, 2017 02:31
transpoint - Twitterにpng画像をアップロードするときにjpeg圧縮が掛からないように右下隅の1ピクセルを透明にする
#!/usr/bin/env ruby
# http://www.mk-mode.com/octopress/2013/08/28/ruby-write-character-by-rmagick/
# http://www.gesource.jp/weblog/?p=194
# transpoint - Twitterにpng画像をアップロードするときにjpeg圧縮が掛からないように右下隅の1ピクセルを透明にする
require 'fileutils'
require 'RMagick'
def transpoint(image_filename)
image = Magick::ImageList.new(image_filename)
@hyuki0000
hyuki0000 / nowtex.sh
Created May 16, 2017 02:21
nowtex.sh - 「いつメモするの? 今でしょ!」的なシェルスクリプト
vi `ruby -e 'puts Time.now.strftime("%Y%m%d%H%M%S")'`.tex
@hyuki0000
hyuki0000 / get-title.rb
Created May 13, 2017 08:54
get-title - URLを与えると、そのページのURLとタイトルをいろんな形式で出力する
#! /usr/bin/env ruby
require 'mechanize'
if ARGV.length != 1
abort("Usage: get-title URL")
end
url = ARGV[0]
agent = Mechanize.new
@hyuki0000
hyuki0000 / mechanize-sample.rb
Created May 13, 2017 08:37
mechanize-sample
#! /usr/bin/env ruby
require 'mechanize'
require 'nokogiri'
agent = Mechanize.new
page1 = agent.get('https://www.google.co.jp')
form = page1.forms[0]
form.q = 'Sports'
page2 = agent.submit(form)