Skip to content

Instantly share code, notes, and snippets.

View toshimaru's full-sized avatar

Toshimaru toshimaru

View GitHub Profile

Keybase proof

I hereby claim:

  • I am toshimaru on github.
  • I am toshimaru (https://keybase.io/toshimaru) on keybase.
  • I have a public key ASATLhYY9BQNHkXYPQ0wypk5wnZ0dkqMZZEKSnCJdexxFAo

To claim this, I am signing this object:

@toshimaru
toshimaru / check-server-process-using-jemalloc.rb
Last active February 9, 2024 14:54
Enable jemalloc for alpine.
# Check server process is using jemalloc
# ref. [Japanese] https://tech.studyplus.co.jp/entry/2019/09/09/094140
class AppController < ActionController::Base
def show
r = `strings /proc/#{Process.pid}/maps | grep jemalloc`
render plain: "<h1>#{ENV['LD_PRELOAD'].presence || 'empty'}</h1><pre>#{r}</pre>"
end
end
@toshimaru
toshimaru / terraform-ssh-remote-exec.tf
Last active August 19, 2023 08:09
How to connect to server via SSH and use remote-exec provisioner.
resource "digitalocean_droplet" "web" {
image = "ubuntu-16-04-x64"
name = "web-1"
region = "sgp1"
size = "512mb"
ssh_keys = [12345]
connection {
type = "ssh"
user = "root"

gihub.ref vs gihub.head_ref

Trigger event pull_request pull_request_target
gihub.ref refs/pull/53/merge refs/heads/main
gihub.head_ref test/pull_request_target test/pull_request_target
  • main: default branch
  • test/pull_request_target: topic branch name
  • 53: pull request number
@toshimaru
toshimaru / 01_prompt.md
Last active July 17, 2023 00:41
10以下の簡単な足し算・引き算。

答えが10以下の1を含む足し算・引き算を30問作成してください。 問題は2列のmarkdown形式の表にまとめてください。


もちろんです。以下に指定の形式で30問の問題をまとめました:

問題 問題
1 + 4 = ? 6 - 1 = ?
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "activerecord"
gem "sqlite3"
gem "enumerize" #, '2.6.1'
@toshimaru
toshimaru / macos-sips-command-manual
Created June 30, 2023 05:51
The result of `man sips` on macOS.
sips(1) General Commands Manual sips(1)
NAME
sips – scriptable image processing system.
SYNOPSIS
sips [image-functions] imagefile ...
sips [profile-functions] profile ...
DESCRIPTION
@toshimaru
toshimaru / file-check.bash
Last active June 27, 2023 06:35
A simple bash script that checks for the existence of specified files:
#!/bin/bash
# Define the list of file paths
filelist=(
"config/database.yml"
"config/setting.yml"
"config.yml"
)
# Check for the existence of each file
Codename Version
Build
PHP Python Ruby Perl
Mac OS X
Lion
10.7.5
Build 11G63
5.3.15 2.7.1 1.8.7 5.12.3
OS X
Mountain Lion
10.8.5
Build 12F2560
5.3.29 2.7.2 1.8.7 5.12.4
OS X
Mavericks
10.9.5
Build 13F1112
5.4.43 2.7.5 2.0.0p481 5.16.2
OS X
Yosemite
10.10.5
Build 14F2511
5.5.38 2.7.10 2.0.0p481 5.18.2
OS X
El Capitan
10.11.6
Build 15G19009
5.5.38 2.7.10 2.0.0p648 5.18.2
macOS
Sierra
10.12.5
Build 16F73
5.6.30 2.7.10 2.0.0p648 5.18.2
macOS
High Sierra
10.13.4
Build 17F199
7.1.14 2.7.10 2.3.3p222 5.18.2
macOSMojave 10.14.6Build 18G103 7.1.23 2.7.10 2.3.7p456 5.18.4

Class Diagram

classDiagram
    Animal <|-- Duck
    Animal <|-- Fish
    Animal <|-- Zebra
    Animal : +int age
    Animal : +String gender
    Animal: +isMammal()