Skip to content

Instantly share code, notes, and snippets.

@shout-poor
shout-poor / Stooq.pm
Last active June 11, 2023 13:41
Gnucash で日本株情報を Stooq.com から取得する Perlモジュール
#!/usr/bin/perl -w
# Copyright (C) 2022 by Kazuyuki Ono <shout@noisyspot.jp>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
@shout-poor
shout-poor / draw_on_image.html
Last active August 28, 2021 13:14
HTML上で、画像に罫線を描画するサンプル
<!DOCTYPE html>
<html>
<head>
<title>画像の上に矩形を描画するサンプル</title>
<script>
const imageUrl = "https://example.com/some/image/url";
const baundaryBox = { x: 0.4, y: 0.4, width: 0.2, height: 0.2 };
@shout-poor
shout-poor / gist:96337287eb47986c2089db1e11eceea9
Created December 10, 2019 10:48
MacOSX Catalina で phpenv を使おうとしたときの ~/.phpenv/plugins/php-build/share/php-build/default_configure_options
--enable-sockets
--enable-exif
--with-zlib
--with-zlib-dir=/usr/local/opt/zlib
--with-bz2=/usr/local/opt/bzip2
--enable-intl
--with-kerberos
--with-openssl
--enable-soap
--enable-xmlreader
@shout-poor
shout-poor / Dockerfile
Created May 12, 2018 04:51
DynamoDB Local のDockerコンテナを作るDockerfile
FROM java:9-jdk
EXPOSE 8000
VOLUME ["/dynamodb/data"]
RUN mkdir -p /dynamodb
WORKDIR /dynamodb
# see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html
RUN wget https://s3-ap-northeast-1.amazonaws.com/dynamodb-local-tokyo/dynamodb_local_latest.tar.gz -qO ./dynamodb_local.tar.gz \
@shout-poor
shout-poor / install_docker_code.sh
Last active May 12, 2018 03:26
Ubuntuにdocker-ceとvs codeを入れる
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-commo
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get update
sudo apt-get install -y docker-ce code
@shout-poor
shout-poor / snipets.sh
Created August 16, 2017 00:59
Shellscript code snipets
# Make a temporary dir, and remove when exit.
TEMPDIR=$(mktemp -d)
trap "rm -rf ${TEMPDIR}" EXIT
@shout-poor
shout-poor / git-prompt-install.sh
Created May 9, 2017 01:36
Install git-completion & git prompt (for bash)
#!/bin/bash
#
# git-completion & git-prompt を導入するスクリプト(for bash)
# git, curl, unzip を事前にインストールしておくこと
#
set -eux
set -o pipefail
@shout-poor
shout-poor / Fibonacci.java
Created September 12, 2015 11:12
Java8のStreamAPIでフィボナッチ関数
import java.math.BigInteger;
import java.util.function.UnaryOperator;
import java.util.stream.Stream;
import static java.math.BigInteger.*;
public class Fibonacci implements UnaryOperator<BigInteger> {
@Override
public BigInteger apply(BigInteger n) {
@shout-poor
shout-poor / gist:4309741
Created December 16, 2012 17:16
Oracle ADF: A method to get a VO from backing bean.
public ViewObject getViewObject(String bindingName) {
BindingContext ctx = BindingContext.getCurrent();
ControlBinding b =
ctx.getCurrentBindingsEntry().getControlBinding(bindingName);
if (b == null) {
throw new IllegalArgumentException(bindingName + " is not found.");
}
if (! (b instanceof DCControlBinding)) {
throw new IllegalArgumentException(bindingName + " is not DCControlBinding.");
}
@shout-poor
shout-poor / sicp-q2-28-iter.scm
Created August 28, 2012 13:51
SICP Q2.28 Iterative-process
(define (fringe items)
(define (fringe-iter items res)
(cond ((null? items) res)
((pair? (car items))
(fringe-iter (append (car items) (cdr items)) res))
(else
(fringe-iter (cdr items) (cons (car items) res)))))
(reverse (fringe-iter items (list))))