Skip to content

Instantly share code, notes, and snippets.

View gh640's full-sized avatar

Goto Hayato gh640

View GitHub Profile
@gh640
gh640 / Dockerfile
Created June 20, 2021 13:19
サンプル: Debian 10 (buster) で言語設定を UTF-8 で日本語にする
FROM debian:buster
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
locales && \
rm -rf /var/lib/apt/lists/*
RUN localedef -f UTF-8 -i ja_JP ja_JP.UTF-8
@gh640
gh640 / use_different_debugger_with_python3.sh
Last active November 4, 2022 08:09
Running IPython or bpython with `breakpoint()` on Python 3
#!/usr/local/bin/bash
# Use IPython.
PYTHONBREAKPOINT=IPython.terminal.debugger.set_trace python myscript.py
# Use bpython.
PYTHONBREAKPOINT=bpdb.set_trace python myscrippt.py
@gh640
gh640 / local.yml
Created June 16, 2021 08:16
Sample: Ansible inventory for localhost
---
all:
hosts:
localhost:
ansible_host: localhost
ansible_connection: local
ansible_python_interpreter: '{{ ansible_playbook_python }}'
@gh640
gh640 / github_cli_fetch_title.sh
Last active May 11, 2021 09:43
Fetching GitHub issue title wth GitHub CLI
# Fetch issue title
gh issue view --json title -q '.title' [issue id]
# Add alias
gh alias set it 'issue view --json title -q ".title"'
# Use the alias
gh it [issue id]
@gh640
gh640 / Dockerfile
Last active May 4, 2021 03:07
Sample: unoconv Docker image based on debian:buster
# DIST can be debian:buster-slim
ARG DIST=debian:buster
FROM $DIST
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends unoconv && \
apt-get clean && \
@gh640
gh640 / dockerfile-user-addition.md
Last active May 19, 2022 12:00
(Japanese) Dockerfile ユーザーの追加方法まとめ

Dockerfile ユーザーの追加方法まとめ

共通の前提

以下のパラメータが設定されているものとします。

@gh640
gh640 / seq.sh
Created May 2, 2021 01:12
Samples: `seq` command
# Normal
seq 1 5
# 1
# 2
# 3
# 4
# 5
seq 5 1
# 5
@gh640
gh640 / card.js
Created April 25, 2021 06:39
Sample: Send a message on Google Chat with Node `axios`
const axios = require(`axios`)
// Pass incoming webhook URL with environment variable `WEBHOOK_URL`.
const WEBHOOK_URL = process.env.WEBHOOK_URL
const title = `Hi`
const subtitle = `Hello`
const paragraph = `Hasta La Vista, Baby.`
const widget = { textParagraph: { text: paragraph } }
axios.post(WEBHOOK_URL, {
@gh640
gh640 / send_message_on_google_chat.py
Last active March 4, 2026 02:01
Sample: Send a message on Google Chat group with Python `requests`
"""A sample to send message on Google Chat group with Python requests.
Prerequisites:
- Google API v1
- A webhook URL taken
- Python 3
- Requests (last tested with 2.31.0)
Usage:
@gh640
gh640 / php_predefined_exceptions.md
Last active April 14, 2021 02:17
PHP 8 / 7.4 predefined exception classes inheritance tree

PHP 8

There are 2 base classes Exception and Error. They both implements Throwable interface.

Exception
  ErrorException
Error
  ArithmeticError
 DivisionByZeroError