Skip to content

Instantly share code, notes, and snippets.

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
@umiyosh
umiyosh / gist:c079526d01d289186992
Last active August 29, 2015 14:18
jsのやつ
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>XHR Test</title>
</head>
<body>
<script>
function request() {
var xhr = new XMLHttpRequest();
@umiyosh
umiyosh / gitlog
Created June 2, 2015 08:41
commitidとか名前とか日付とかブランチ名とかcommitログ内容とかを一行でベロっとだす
17:39:18 [0] % git log --date=iso --pretty=format:'%h - <%an> %ce - %cd - %d %s ' --abbrev-commit
32b7f0c - <umiyosh> yumino99@gmail.com - 2015-06-02 15:12:05 +0900 - (HEAD, master) .libだとvimにfiletype=cobolと判定されるので名前変更
e67dfbc - <umiyosh> yumino99@gmail.com - 2015-06-02 15:10:29 +0900 - alias分離しても見通しよくないので.pecoにマージ
5455678 - <umiyosh> yumino99@gmail.com - 2015-06-02 02:30:00 +0900 - (origin/master, origin/HEAD) コメントTODO 除去し忘れ
ad6e2ec - <umiyosh> yumino99@gmail.com - 2015-06-02 02:25:21 +0900 - (origin/pecoAutload) pecoのzsh関数をautoload化した
002eca5 - <umiyosh> yumino99@gmail.com - 2015-06-01 21:06:07 +0900 - (pecoAutload) 一部Autoload化
a507868 - <umiyosh> yumino99@gmail.com - 2015-05-29 15:29:49 +0900 - 見通しが悪くなってきたのでpecoのあれこれを分離
91b51fc - <umiyosh> yumino99@gmail.com - 2015-05-28 19:25:10 +0900 - 相対パスでlできないの不便なので付け足し
a7811de - <umiyosh> yumino99@gmail.com - 2015-05-28 18:00:52 +0900 - tmuxの依存度をちょっと減らした
7808011 - <umiyosh> yumino99@gmail.com - 2015-05-20 18:55:29 +0900 - 保存時にjshint
@umiyosh
umiyosh / warnmem_firefox.pl
Created May 12, 2011 17:49
firefox memory checker for windows
#!/usr/bin/perl
#must need cygwin enviroment and Win Growl
#install :
#$ cygrunsrv --install "firefox mem checker" --path /home/$(whoami)/bin/warnmem_firefox.pl --args 600000
#uninstall :
#$ cygrunsrv --remove "firefox mem checker"
use strict;
use warnings;
" 文字コードの自動認識
if &encoding !=# 'utf-8'
set encoding=japan
set fileencoding=japan
endif
if has('iconv')
let s:enc_euc = 'euc-jp'
let s:enc_jis = 'iso-2022-jp'
" iconvがeucJP-msに対応しているかをチェック
if iconv("\x87\x64\x87\x6a", 'cp932', 'eucjp-ms') ==# "\xad\xc5\xad\xcb"
javascript: window.open('http://b.hatena.ne.jp/entry/'+window.location)
@umiyosh
umiyosh / gist:3663168
Created September 7, 2012 04:37
pandoc.css (pandocに食わしてmarkdownをGitHubのmarkdownっぽい見栄えにする)
body {
margin: auto;
padding-right: 1em;
padding-left: 1em;
max-width: 60em;
border-left: 1px solid black;
border-right: 1px solid black;
color: black;
font-family: Helvetica, arial, sans-serif;
background-color: white;
@umiyosh
umiyosh / getShardDistribution.sh
Created March 18, 2016 06:00
mongodb getShardDistributionをcollection全部にやるやつ
#!/usr/bin/env zsh
set -eu
remote=${1:-localhost}
database=${2:-test}
mongos=(--host $remote $database --port 27017)
collections=($(echo "show collections" | mongo $mongos --quiet))
echo "show collections" | mongo $mongos
for col in $collections
do
@umiyosh
umiyosh / 4lineDialy.md
Last active June 4, 2016 10:36
4line Daily Template

4line Diary Template

  • 1ST [Fact] Write things which you actually did in the daytime

  • 2ND [Awareness] Write things which you became aware of through a fact(review)

  • 3RD [Lesson] Decide to do the next action through deriving things from your awareness

  • 4TH [Declaration] Draw yourself with making use of the lesson

@umiyosh
umiyosh / pretty_cluster_node.py
Created March 27, 2017 13:23
pretty_cluster_node.py
import fileinput
import re
masters_info = []
slaves_info = []
for line in fileinput.input():
info = {}
cluster_node = re.split(r' +', line)
if 'master' in cluster_node[2]: