Skip to content

Instantly share code, notes, and snippets.

@yoh2
yoh2 / Hoge.cs
Last active January 26, 2018 12:06
a == 1 && a == 2 && a == 3 を真に。
public class Hoge
{
public static void Main(string[] args)
{
var a = new Hoge();
System.Console.WriteLine("{0}", a == 1 && a == 2 && a == 3);
}
public static bool operator==(Hoge hoge, int n)
{
@yoh2
yoh2 / 00note.md
Last active October 20, 2017 13:24
吉里吉里ムービー再生関連

吉里吉里ムービー再生関連メモ

概要

吉里吉里を利用した作品において、ムービーの再生に失敗する。失敗時の挙動は作品によって異なり、以下のパターンを観測している。

[2017-10-20追記]: 吉里吉里以外でも発生。後述の現象が発生する作品には CatSystem2 のものもある。

  • 何も再生されずにムービー再生が完了したように振る舞う。
  • アプリケーションの強制終了が発生する。
@yoh2
yoh2 / Program.cs
Last active October 8, 2017 17:41
吉里吉里でのムービー再生問題 (32論理コア搭載機で再生できない) 回避プログラム
using System;
using System.Diagnostics;
using System.Text;
namespace KirikiriCoresAdjustor
{
static class Program
{
/// <summary>
/// アプリケーションのメイン エントリ ポイントです。
@yoh2
yoh2 / p.pl
Last active September 20, 2017 17:54
2人の子供のうち少なくとも一方が女の子の時もう一方も女の子である確率 のモンテカルロ法
#!/usr/bin/perl -w
use strict;
my $total = 0; # どちらか一方が女の子であった数
my $n = 0; # もう一方も女の子 (つまりふたりとも女の子) であった数
foreach(0 .. 10000)
{
# ふたり分の性別。男の子: 0, 女の子: 1 とみなす。
@yoh2
yoh2 / stylish.css
Last active July 29, 2017 15:47
Twitter web client avatar fixup
.ProfileAvatar, .avatar, .DashboardProfileCard-avatarImage, .ProfileAvatar-image, .ProfileAvatar-placeholderImage {
border-radius: 8% !important;
}
@yoh2
yoh2 / yes.rs
Last active June 15, 2017 13:24
yes
use std::iter::FromIterator;
use std::io::{Write, Result};
const BUF_SIZE: usize = 8192;
fn main() {
if let Some(message) = message() {
let buf = prepare_buf(&message.into_bytes());
let mut stdout = std::io::stdout();
while let Ok(written) = write_all(&mut stdout, &buf) {
/home/y_honda/src/mikutter/core/mui/cairo_miracle_painter.rb: line 349
Gdk-CRITICAL **:IA__gdk_pixbuf_get_from_drawable: assertion 'src_x + width <= src_width && src_y + height <= src_height' failed
/home/y_honda/src/mikutter/core/mui/cairo_miracle_painter.rb: line 349
Gdk-CRITICAL **:IA__gdk_pixbuf_get_from_drawable: assertion 'src_x + width <= src_width && src_y + height <= src_height' failed
/home/y_honda/src/mikutter/core/mui/cairo_miracle_painter.rb: line 349
Gdk-CRITICAL **:IA__gdk_pixbuf_get_from_drawable: assertion 'src_x + width <= src_width && src_y + height <= src_height' failed
/home/y_honda/src/mikutter/core/plugin/activity/activity.rb:174: [BUG] Segmentation fault at 0x00000000000009
ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]
-- Control frame information -----------------------------------------------
html {
height: 100%;
}
body {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKgAAABACAQAAAAkVfTQAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAasSURBVHja7ZtZbBVVGMd/bYHSBW+hlIJQSiubYZWAoCwBATVRCcomkNREZXkgJpiIuCGB+qAmVhTjQyUKxigQFtGA+4KyGQVkR8oii6FcaltaaC9dxofO/e6hd2bu1HtPWTL/+9AzZ+ac75z/nPOdb5mCBw8ePHjw4MGDBw8ePHhoClp4FMQSsziJQYCtZHpkRI8caqjHwMBgu0dH9BhLjUmnQYA7PEKiRUsuCqEGnW75+aZzH+k6BcSzU+j86Jan80HKuMIpeulcoX4hdPgtTmcKe8yZLtNnGCXRVsolEXpJJZkarlJDDcZNSGg2A83SQH2EziHBLAX410YpQDrDeYUs4rhCBRVcopxySinBj58DnLwpCM2SUit9Jv1p2fAFlmQuYDXnqFYOLvVXTx21XGYxcTcBoX/JuDfrEtFGRFQpWz+0xffZEBlObM4NT+daZbxTdAnJFBFlYWohntUu6TSoY7qjnAx60vK60jmAgIz2F31iuomQYtGlQfSkNmwdVhGghrowQi/gc5DyCPs5w0pSryOh98tYa7hNX/ijtZSqw87t2cRL2eASi9hCC9JpTwfSaUcaPnz4aM0xXqLcYXW+Rl8gj3QmUG/WjmcmK3SulUYYJqU/uaRzIwT9+ENhx8ob8k4/Y1DY+m1AAq1IUoi3QhdOSU8jzLp883pSM9GZJ/M0WKRT0BARs8ti9Tbc2R21lJ9Eymyz5qx5vbdZQoczFeV0MTaKx27YIc1XFnavmkwWUhmDN3o6rKa9+bcftdrpTCVfyrU8RKVOYTPkza3SKGWKSPHLxBquK5phfQ5XDte7YhcCscbtUjqn1QKsl5XZA0gVjVwWMxn9bc
import qualified Data.Map as M (lookup)
import Data.Map (Map, fromList)
import Data.List (permutations)
import Data.Maybe (fromJust)
dictionaryFromList :: [Int] -> Map Char Int
dictionaryFromList xs = fromList $ zip ['a' .. 'j'] xs
transformByMap :: Ord a => [a] -> Map a b -> [b]
transformByMap xs dic = map (fromJust . flip M.lookup dic) xs
@yoh2
yoh2 / 60-inconsolata.conf
Last active December 19, 2016 09:34
Inconsolata を Ricty ぽく。 ${HOME}/.config/fontconfig/conf.d/ あたりに置いて使う。
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test qual="any" name="family"><string>Inconsolata</string></test>
<edit name="family" mode="append" binding="strong"><string>Migu 1M</string></edit>
</match>
</fontconfig>