This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
WAIT_SECONDS=1 | |
USER_AGENT='Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0' | |
logger_info() { | |
echo "$(LANG=C date --rfc-3339=seconds) [INFO] ${1}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import subprocess | |
HOMEDIR = os.getenv('HOME') | |
GIT_COMMAND = 'git pull --rebase origin master' | |
git_clone_dirs = ['.rbenv', '.rbenv/plugins/ruby-build', '.pyenv'] | |
brew_commands = ['perlbrew self-upgrade', 'perlbrew -f install-cpanm', 'nodebrew selfupdate'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# Send E-mail from eml file in PowerShell | |
# Tested on PowerShell 2.0 | |
# | |
# Usage: | |
# 1. Configure the variables defined in Main() | |
# $server = "localhost" | |
# $port = "25" | |
# $mailfrom = "from@example.com" | |
# $rcptto = "to@example.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
PL/SQL sample for HTTP access (Oracle 11g R2) | |
1. Execute /u01/app/oracle/product/11.2.0/xe/rdbms/admin/utlhttp.sql to use UTL_HTTP package | |
Run the following command in shell in the DB server | |
$ cd /u01/app/oracle/product/11.2.0/xe/rdbms/admin/ | |
$ sqlplus SYS/passwd@localhost:1521/XE AS SYSDBA @utlhttp.sql | |
2. Grant the connect and resolve privileges for all hosts to the user 'SCOTT' | |
Run the following commands in SQL*Plus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#compdef tmuxinator mux | |
# zsh completion for tmuxinator | |
# Install: | |
# $ mkdir -p ~/.tmuxinator/completion | |
# $ cp _tmuxinator ~/.tmuxinator/completion | |
# $ vi ~/.zshrc # add the following codes | |
# fpath=($HOME/.tmuxinator/completion ${fpath}) | |
# autoload -U compinit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; AutoHotKey_LでEmacsキーバインドにするスクリプト | |
;; | |
;; 使い方 | |
;; ・AutoHotKey_L(http://l.autohotkey.net/)をインストール | |
;; ・Emacs.ahkをAutoHotkeyをインストールしたフォルダ(デフォルトならC:\Program Files\AutoHotkey)に保存 | |
;; ・タスクバーにあるAutoHotkeyのアイコン([H])を右クリックし、"Edit This Script"を選択 | |
;; ・メモ帳でAutoHotkey.ahkが開くので、最後に以下の行を追加 | |
;; #include Emacs.ahk | |
;; ・AutoHotkeyアイコンを右クリックして"Reload This Script"を選択してリロード | |
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PowerShell Drag & Drop sample | |
# Usage: | |
# powershell -sta -file dragdrop.ps1 | |
# (-sta flag is required) | |
# | |
Function DragDropSample() { | |
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | |
$form = New-Object Windows.Forms.Form | |
$form.text = "Drag&Drop sample" | |
$listBox = New-Object Windows.Forms.ListBox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'set' | |
class RPN | |
def initialize(exp) | |
@exp = exp.split(/\s+/) | |
@stack = [] | |
@operators = Set['+', '-', '*', '/', '%'].freeze | |
end | |
def eval |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Priority Queueの練習 | |
# | |
# 参考 | |
# - https://ufcpp.net/study/algorithm/col_heap.html | |
class PriorityQueue | |
attr_reader :data, :test_function | |
def initialize(test_function = ->(a, b) { a <=> b }) | |
@data = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ヒープソートの練習 | |
# | |
# 参考 | |
# - https://ufcpp.net/study/algorithm/col_heap.html | |
# - https://ufcpp.net/study/algorithm/sort_heap.html | |
def make_heap(array, last_index) | |
while (last_index > 0) | |
parent = ((last_index - 1) / 2).floor | |
break unless (array[last_index] > array[parent]) |
NewerOlder