Skip to content

Instantly share code, notes, and snippets.

View 44uk's full-sized avatar
♨️
ズイ₍₍(ง˘ω˘)ว⁾⁾ズイ

Yoshiyuki IEYAMA 44uk

♨️
ズイ₍₍(ง˘ω˘)ว⁾⁾ズイ
View GitHub Profile
@44uk
44uk / timeAgoInWords
Created September 10, 2013 03:58
timeAgoInWords
<?php
function timeAgoInWords($datetime, $now = null){
if($now === null){ $now = date('Y-m-d H:i:s'); }
$units = array(
'y' => 31104000,
'm' => 2592000,
'd' => 86400,
'h' => 3600,
@44uk
44uk / ipa_past_exam_urls.sh
Created September 22, 2013 05:25
IPA 情報処理技術者試験過去問のURLリスト作成
#!/bin/sh -x
if [ ! -x "`which wget`" ]; then
echo "Required wget."
exit 1
fi
mkdir exams
# PDF の url 抽出
@44uk
44uk / shadow-box-ios7-safari-resize-overlay.js
Last active December 26, 2015 16:59
Snippet for resizing ShadowBox's overlay to resolve problem safari on iOS7
(function(){
var handler = null;
Shadowbox.init({
onOpen: function() {
handler = setInterval(function() {
sbo = document.getElementById('sb-overlay')
if(sbo){
sbo.style.height = window.innerHeight + "px";
}
}, 100);
#!/bin/bash
if [ $# -ne 1 ]; then
echo "you need to provide private key";
exit 1
fi
key=`echo $1 | sed 's/[0-9a-fA-F]*//'`
if [ -n "$key" ];
then
@44uk
44uk / index.html
Last active June 5, 2017 07:09
[NEM] PrivateKey -> PublicKey, Address Converter // source https://jsbin.com/zifipel
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>[NEM] PrivateKey -> PublicKey, Address Converter</title>
<style>
h1 {
font-size: 0.95rem;
}
@44uk
44uk / click365_summary.sh
Last active June 22, 2017 04:16
くりっく365 サマリデータ ダウンロードスクリプト
#!/bin/bash
# https://www.tfx.co.jp/historical/fx/#anchor03
# くりっく365 サマリデータ ダウンロード
# ペアと年度を指定したダウンロードを行います。
PAIR=$1
YEAR=$2
[ -z $PAIR ] && echo 'currency PAIR required as first argument.' && exit 1
[ -z $YEAR ] && echo 'from YEAR required as second argument.' && exit 1
@44uk
44uk / ZaifAPI_Sample.sh
Created August 10, 2017 09:13
ZaifAPIのtradeAPIをシェルスクリプトで叩く
#!/bin/bash
# http://techbureau-api-document.readthedocs.io/ja/latest/trade/
NONCE=$(date "+%s")
KEY=__YOUR_KEY__
SECRET=__YOUR_SECRET__
METHOD=get_info
PARAMS="nonce=$NONCE&method=$METHOD"
SIGN=$(echo -n $PARAMS | openssl dgst -hmac $SECRET -sha512 | sed 's/^.* //')
curl https://api.zaif.jp/tapi -H "Key: $KEY" -H "Sign: $SIGN" -d $PARAMS
# ex)
# curl -kL {raw_url} | sudo bash
# disable and unmount floppy device
bash -c "echo 'blacklist floppy' > /etc/modprobe.d/blacklist-floppy.conf"
rmmod floppy && update-initramfs -u
unlink /media/floppy && rmdir /media/floppy0
# CapsLock => ctrl
grep 'XKBOPTIONS="ctrl:nocaps"' /etc/default/keyboard || echo 'XKBOPTIONS="ctrl:nocaps"' >> /etc/default/keyboard
@44uk
44uk / rserver.rb
Created August 20, 2012 15:34
Ruby Simple Local Server
#!/usr/bin/env ruby
require 'webrick'
srv = WEBrick::HTTPServer.new(
:BindAddress => '127.0.0.1', # '0.0.0.0' allow remote access
:Port => (port = ARGV[0].to_i) === 0 ? 3000 : port,
:DocumentRoot => './',
:DoNotReverseLookup => true
)
trap(:INT){srv.shutdown}
srv.start
@44uk
44uk / Dockerfile
Last active January 7, 2018 08:19
Dockerfile for koto minerd
FROM alpine:latest
MAINTAINER Yoshiyuki Ieyama <44uk@github.com>
ENV SRCURL=https://github.com/koto-dev/cpuminer-yescrypt/archive/master.tar.gz
RUN apk add --update --no-cache automake autoconf gawk build-base curl curl-dev gcc tar make \
&& mkdir __workdir && cd $_ \
&& curl -kL $SRCURL | tar xz --strip=1 \
&& ./autogen.sh \
&& ./configure CFLAGS="-O3 -march=native -funroll-loops -fomit-frame-pointer" \
&& make && make install && make clean \
&& cd ../ && rm -rf __workdir