Skip to content

Instantly share code, notes, and snippets.

@kou1okada
kou1okada / SimpleCalendar.js
Last active February 23, 2021 17:20
SimpleCalendar.js
/**
* Simple Calendar
* Copyright (c) 2021 Koichi OKADA. All rights reserved.
* This script is distributed under the MIT license.
*/
(function(){
let wd0 = 0; // week day of the first cell in calendar
let pad = (s,w,c="0")=>(Array(w).fill(c).join("")+s).slice(-w);
let isSameMonth = (d1,d2) => d1.getMonth() == d2.getMonth();
let today = new Date();
@kou1okada
kou1okada / Dockerfile
Last active December 20, 2020 03:39
docker-squid
FROM ubuntu
MAINTAINER kou1okada <[email protected]>
env DEBIAN_FRONTEND=noninteractive
RUN \
sed -i -E 's@https?://[^ ]+@http://mirrors.evowise.com/ubuntu/@g' /etc/apt/sources.list && \
apt-get update &&\
apt-get install -y --no-install-recommends squid &&\
apt-get clean &&\
@kou1okada
kou1okada / attach-ssh-agent.sh
Last active April 7, 2022 03:47
attach-ssh-agent.sh - Attach ssh-agent
#!/usr/bin/env bash
#
# attach-ssh-agent.sh - Attach ssh-agent
# Copyright (c) 2020 Koichi OKADA. All rights reserved.
# This script is distributed under the MIT License.
#
# Usage:
# Include from .bashrc as:
# . attach-ssh-agent.sh
#
@kou1okada
kou1okada / decompression_bench.sh
Last active January 11, 2022 11:51
decompression_benchmark.sh - Decompression Benchmark
#!/usr/bin/env bash
if (( $# != 2 )); then
cat <<-EOD
Usage: ${0##*/} <count> <file>
Decompression benchmark
EOD
exit
fi
@kou1okada
kou1okada / wpra.sh
Last active January 11, 2022 11:51
wpra.sh - Wikipedia REST API utility
#!/usr/bin/env bash
. hhs.bash 0.2.0
function init_wpra_math ()
{
: ${PREVIEW_METHOD:=sixel}
}
function optparse_wpra_math ()
@kou1okada
kou1okada / README.md
Last active February 20, 2023 16:24
docker-lstags.sh - list tags for docker image

docker-lstags.sh - list tags for docker image

Usage

Usage: docker-lstags.sh [<namespace>/]<repository>

Requires

@kou1okada
kou1okada / README.md
Last active May 26, 2022 13:31
proxy.sh - Proxy Auto-Configuration Utility

proxy.sh - Proxy Auto-Configuration Utility

Usage

Add below commands to ~/.bashrc.

. $SOMEWHERE/proxy.sh # [auto|fromsystem|pac <URL>|wpad]
@kou1okada
kou1okada / Moodle2LoginAutoFocusUsername.js
Created April 27, 2020 08:20
Moodle 2: Login: Auto focus username
/**
* Moodle 2: Login: Auto focus username
*/
(function(){
function focus_to_username() {
if (!location.href.match('/login/(index\.php)?$')) return;
let e = document.getElementById("username");
if (e) e.focus();
}
function onDOMContentLoaded(f) {
@kou1okada
kou1okada / README.md
Last active January 11, 2022 11:51
procio.sh: Show process I/O

procio.sh: Show process I/O

Show process I/O by /proc/<pid>/io.

Usage

procio.sh [OPTIONS ...] <pid>

License

@kou1okada
kou1okada / Jitsi-memo.md
Last active April 17, 2020 10:01
Jitsi-memo