Skip to content

Instantly share code, notes, and snippets.

💩
ときどきトイレに引っかかって流れないのイラッとする( ・ั﹏・ั)

Harai Akihiro harai

💩
ときどきトイレに引っかかって流れないのイラッとする( ・ั﹏・ั)
Block or report user

Report or block harai

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View demofile.php
<?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');
@harai
harai / sort-firefox-containers.py
Created Apr 16, 2017
Sort Firefox container tab items
View sort-firefox-containers.py
#!/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 / script.sh
Last active Feb 13, 2017
Setting Up Build Environment of AWS Lambda
View script.sh
#!/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 / setup-bootstrap.sh
Last active Sep 1, 2018
Ubuntu再インストール用bootstrap
View setup-bootstrap.sh
sudo apt install -y git
ssh-keygen -f ~/.ssh/id_rsa -t rsa
cat ~/.ssh/id_rsa.pub
# Add the pubkey to BitBucket/GitHub
# https://bitbucket.org/account/user/jharai/ssh-keys/
# https://github.com/settings/ssh
cd
git clone git@bitbucket.org:jharai/config.git Config
gedit Config/command &
@harai
harai / inbox-title-patch.user.js
Created Nov 24, 2015
Title patch for Inbox by Gmail™
View inbox-title-patch.user.js
// ==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 / Dockerfile
Created Nov 5, 2015
Dockerfile which starts Google Chrome
View Dockerfile
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 / gigasort.rb
Created Jun 20, 2015
10GBの数値データをソートするプログラム
View gigasort.rb
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 / backlog2md.user.js
Last active Aug 29, 2015
Convert Backlog™ notation to Markdown.
View backlog2md.user.js
// ==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
View crontab
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 / gist:91c87437b18331e51a23
Last active Aug 29, 2015
ライフチェンジングなpercolとautojumpの紹介 - 404 Engineer Logs http://blog.zoncoen.net/blog/2014/01/14/percol-autojump-with-zsh/ のUbuntu 14.04対応版
View gist:91c87437b18331e51a23
function exists { which $1 &> /dev/null }
if exists percol; then
function percol_select_history() {
local tac
BUFFER=$(history | sed -e "s/^\\s*[0-9]*\\s*\\*\?\\s*//g" | tac | percol --query "$LBUFFER")
CURSOR=$#BUFFER # move cursor
zle -R -c # refresh
}
You can’t perform that action at this time.