Skip to content

Instantly share code, notes, and snippets.

View yashihei's full-sized avatar

Ryuhei Kobayashi yashihei

View GitHub Profile
@yashihei
yashihei / sukuma.js
Created December 12, 2023 00:12
スクマ(日付+OGP付き)
javascript: (function() {
var title = window.prompt(`Scrap "${document.title}" to yashihei-bookmark.`, document.title);
if (!title) return;
var ogImage = document.querySelector('meta[property="og:image"]') ? document.querySelector('meta[property="og:image"]').getAttribute('content') : '';
var ogDescription = document.querySelector('meta[property="og:description"]') ? document.querySelector('meta[property="og:description"]').getAttribute('content') : '';
var lines = ['[' + window.location.href + ' ' + document.title + ']'];
var today = new Date();
@yashihei
yashihei / hatebu_to_scrapbox.go
Last active December 10, 2023 04:27
hatebu_to_scrapbox.go(ほぼChatGPTに書いてもらった)
package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
"strconv"
"time"
@yashihei
yashihei / memo.md
Last active November 20, 2023 20:43
Spotifyのキャッシュを1GBに制限する(Windows)

AppDataが膨れ上がってるなと思ったらSpotifyお前だったのか (キャッシュが10GBぐらいあった…)

  1. Spotifyを閉じる
  2. C:\Users\{username}\AppData\Local\Spotify\Data のキャッシュを全部消す
  3. C:\Users\{username}\AppData\Roaming\Spotify\prefs に以下の設定を記述する
storage.size=1024
@yashihei
yashihei / memo.md
Created February 28, 2020 18:22
HHKB(US配列) + Windows + Google IME使ってるときの個人的セットアップ
  1. 背面スイッチは1, 3, 5をONに
    • Lite拡張モード(PC)
    • DeleteキーをBSに置き換える
    • ◇キーをAltに置き換える
  2. Google IMEの「プロパティ」「キー設定の選択」の編集を開く
  3. コマンド「IMEを有効化」「IMEを無効化」に「Ctrl Space」を割り当てる
@yashihei
yashihei / gist:d4bcbf02b2f55e048fbfd5a93f81e225
Last active April 20, 2019 16:31
bashで、スラッシュ -> バックスラッシュに置換したい時

sedコマンドを使います。

sed [OPTION]... {script-only-if-no-other-script} [input-file]...

sedコマンドを使った置換の例。(abc -> ABC)

$ sed -e 's/abc/ABC/g'
@yashihei
yashihei / gist:45e57ccda275d94d361e3caebd680adc
Created April 19, 2019 13:32
bundle install時、ovirt-engine-sdkでコケる

(´・ω・`)

Fetching ovirt-engine-sdk 4.3.0
Installing ovirt-engine-sdk 4.3.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /home/hakase/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/ovirt-engine-sdk-4.3.0/ext/ovirtsdk4c
/home/hakase/.rbenv/versions/2.6.2/bin/ruby -I /home/hakase/.rbenv/versions/2.6.2/lib/ruby/2.6.0 -r ./siteconf20190419-51352-10rnc6r.rb extconf.rb
checking for xml2-config... yes
checking for curl-config... no

erbもっと楽に書きたい!

Gemfile以下を記載。

gem "haml-rails", "~> 2.0"

以下のコマンドでerb->hamlに変換。Rails5以降、rakeコマンドをrailsコマンドで叩けるようになった。

$ rails haml:erb2haml
@yashihei
yashihei / gist:0fed2089e35bb7bddc32d720d08da27a
Last active April 15, 2019 16:24
自宅のXubuntuをセットアップしていく

社のMacだけじゃなくて、自宅でもRailsとか触っていきたいので。かなり自分向けのメモ。
随時更新予定。

環境: Win10 + VMWare 14 + Xubuntu(LTS18.04)

VMwareのセットアップ

よしなに。

最初にやること

ホームディレクトリの日本語化。

@yashihei
yashihei / gist:4223b66af2ee09bf76b99e1ddfb2f86e
Last active October 31, 2022 10:53
Rider入れてからやったこと

.gitignore

Unityの場合、以下の設定を.gitignoreに追加。

/.idea/

ideavim

Settings内の「Vim Emulation」でキー入力をVimで取るか、IDEで取るか選択出来る。

@yashihei
yashihei / tips.md
Last active June 21, 2020 04:03
BoxCast使うときのTips

RaycastやLinecastを使って、接地判定やショットの当たり判定を取ってたけど、やっぱり太さが欲しいのでBoxCastを使った。

BoxCastの死角

詳しくはテラシュールさんのブログ(http://tsubakit1.hateblo.jp/entry/2016/02/25/025922#BoxCast%E3%81%A8SphereCast%E3%81%AE%E6%AD%BB%E8%A7%92) にて書かれてる。BoxCastの仕様上、開始地点を判定しないのでその部分の判定をOverlapBoxなどで補う必要がある。

NonAlloc版のOverlapBoxについて

private Collider[] _buffer = new Collider[4];