Skip to content

Instantly share code, notes, and snippets.

View harai's full-sized avatar

Harai Akihiro harai

  • Tsu, Mie, Japan
View GitHub Profile
SHELL=/usr/bin/zsh
HOME=/home/jharai
PATH=/home/jharai/bin:/home/jharai/.rbenv/shims:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
@harai
harai / backlog2md.user.js
Last active August 29, 2015 14:22
Convert Backlog™ notation to Markdown.
// ==UserScript==
// @name Backlog™2Markdown
// @namespace https://github.com/harai/
// @description Convert Backlog™ notation to Markdown.
// @include https://*.backlog.jp/*
// @version 1.0.1
// ==/UserScript==
//
// Copyright (C) 2015 Akihiro HARAI
// Originally created by edvakf
@harai
harai / gigasort.rb
Created June 20, 2015 07:23
10GBの数値データをソートするプログラム
require 'securerandom'
INIT_CHUNK_LINES = 10000000
WRITE_CHUNK_LINES = 1000000
def find_smallest_pair(path)
files = Dir["#{path}/*"].sort_by do |f|
File.size(f)
end
if files.size < 2
@harai
harai / Dockerfile
Created November 5, 2015 03:47
Dockerfile which starts Google Chrome
FROM ubuntu:14.04
#
# Usage:
# docker build -t chrome .
# docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix chrome
#
# Created originally by:
# http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/
#
@harai
harai / inbox-title-patch.user.js
Created November 24, 2015 01:23
Title patch for Inbox by Gmail™
// ==UserScript==
// @name Title patch for Inbox by Gmail™
// @namespace com.github.harai
// @description Count unread messages and display it as the page's title.
// @include https://inbox.google.com/*
// @version 1
// @grant none
// ==/UserScript==
setInterval(function() {
@harai
harai / setup-bootstrap.sh
Last active March 29, 2020 00:45
Ubuntu再インストール用bootstrap
# Open about:config on Firefox and set:
#
# services.sync.prefs.dangerously_allow_arbitrary true
#
sudo apt install -y git
ssh-keygen -f ~/.ssh/id_rsa -t rsa
cat ~/.ssh/id_rsa.pub
# Add the pubkey to BitBucket/GitHub
@harai
harai / script.sh
Last active February 13, 2017 23:19
Setting Up Build Environment of AWS Lambda
#!/bin/bash
set -e -x
yum -y update
yum -y upgrade
yum -y groupinstall "Development Tools"
yum -y install zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel git
export HOME=/home/ec2-user
@harai
harai / sort-firefox-containers.py
Created April 16, 2017 05:32
Sort Firefox container tab items
#!/usr/bin/env python3
import json
import glob
from os import path
def get_jsonpath():
homedir = path.expanduser('~')
profiledirs = glob.glob('{}/.mozilla/firefox/*.default'.format(homedir))
@harai
harai / demofile.php
Created June 14, 2019 04:52
demofile
<?php
$url = 'https://downloads.wordpress.org/plugin/woocommerce.3.6.4.zip';
$tmpname = tempnam("/tmp", "kawarimi");
file_put_contents($tmpname, fopen($url, 'r'));
$zip = new ZipArchive;
$res = $zip->open($tmpname);
$zip->extractTo('./wp-content/plugins');
$zip->close();
exec('wp plugin activate woocommerce');