Skip to content

Instantly share code, notes, and snippets.

@zunda
zunda / ojo.c
Created June 23, 2022 03:15
おっさんなのでCでお嬢様になる
#include <stdio.h>
#define ここの int
#define ご主人 main()
#define 様は以下のことをなさいます {
#define 以上ですわ }
#define お返しするのは return
#define でしてよ ;
#define 標準出力に表示させるのは(x) puts((x))
@zunda
zunda / binary-pi.rb
Last active June 4, 2022 08:24
二進のπ
# 二進のπ
# Inspired from https://twitter.com/indozou/status/1520073427172093952
#
# Copyright 2022 <zundan at gmail.com>
#
# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.
class Numeric
@zunda
zunda / gist:1c5afcb06ac233f89e40728dfce7de4c
Last active May 3, 2022 18:55
ZundonにRedisを追加した
# アプリ名
ruby=zundan-mastodon
node=zundan-mastodon-streaming
# 別窓で
heroku logs -t -a $ruby & heroku logs -t -a $node &
# Redisへの書き込みを停止
date # Tue May 3 08:30:18 AM HST 2022
for a in $ruby $node; do heroku maintenance:on -a $a; done
warning: parser/current is loading parser/ruby31, which recognizes3.1.0-compliant syntax, but you are running 3.1.1.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Migrating to OptimizeNullIndexConversationsUri (20220307083603)
== 20220307083603 OptimizeNullIndexConversationsUri: migrating ================
[strong_migrations] DANGER: No lock timeout set
-- index_name_exists?(:conversations, "index_conversations_on_uri_new")
-> 0.0024s
-- add_index(:conversations, :uri, {:unique=>true, :where=>"uri IS NOT NULL", :opclass=>:text_pattern_ops, :name=>"index_conversations_on_uri_new", :algorithm=>:concurrently})
-> 47.2752s
-- index_name_exists?(:conversations, "index_conversations_on_uri")
#!/usr/bin/ruby
#
# Usage:
# $ echo わたしたわしわたしたわ | ruby koikekeiko.rb
# 11/1
# $ echo こしたんたん | ruby koikekeiko.rb
# 3/2
#
# Calculates the "saiwaisa" of the input as defined in
# 2022年度 大学入学共通テスト 本試験 情報関係基礎
@zunda
zunda / Makefile
Last active January 28, 2022 18:36
ねこがねころんだ
default: shuffle
echo ねこがねころんだ | ./shuffle
clean:
rm shuffle
@zunda
zunda / check-build-cap.rb
Last active January 16, 2022 20:26
Netlifyのビルド時間が充分残っているか確認する
#!/usr/bin/ruby
require 'net/http'
require 'json'
TeamSlug = "zunda"
UserAgent = "#{File.basename($0, '.rb')} (zundan@gmail.com)"
MinMinutes = 15
begin
Token=ENV.fetch('TOKEN')
@zunda
zunda / .gitignore
Last active December 30, 2021 00:00
Trying to self-modify dynamic shared library
/main
*.so
@zunda
zunda / gist:8534b47a194fef1b235b2d5f3d20279f
Created December 28, 2021 19:24
git log --oneline upstream/main...origin/master
fe7154884 (upstream/main) Fix warnings on Rails boot (#16946)
e65080181 Fix tag rendering error in hashtag column settings (#17184)
d78ddb1ce Modify Readme syntax (#17112)
4d1eaf3e6 Finish update of node-redis (#17183)
fad37dd1b Save bundle config as local (#17188)
56c55ab9f Add ReadWritePaths directive to service files (#17178)
512bc9db7 Bump redis from 3.1.2 to 4.0.1 (#17161)
7cd26c8db Bump bullet from 6.1.5 to 7.0.0 (#17154)
cde4976d4 Bump npmlog from 5.0.1 to 6.0.0 (#17026)
82fdc81ae Bump eslint-plugin-promise from 5.1.1 to 6.0.0 (#17173)
@zunda
zunda / monitor-packet-loss.rb
Created December 25, 2021 23:48
Shows rough estimates of packet loss using the `ping` command
#!/usr/bin/ruby
#
# usage: ruby monitor-packet-loss.rb <ISP's-gateway-IP-address>
# Shows rough estimates of packet loss using the `ping` command.
#
# Copyright 2021 by zunda <zundan at gmail.com>
#
# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.