Skip to content

Instantly share code, notes, and snippets.

View mizukmb's full-sized avatar
🏠
Working from home

Yuto MIZUSHIRI mizukmb

🏠
Working from home
View GitHub Profile
@mizukmb
mizukmb / killme.rb
Last active August 29, 2015 14:06
# -*- coding: utf-8 -*-
require "twitter"
require 'open-uri'
require 'nokogiri'
CONSUMER_KEY = "あなたのCONSUMER_KEY"
CONSUMER_SECRET = "あなたのCONSUMER_SECRET"
OAUTH_TOKEN = "あなたのOAUTH_TOKEN"
OAUTH_TOKEN_SECRET = "あなたのOAUTH_TOKEN_SECRET"
@mizukmb
mizukmb / jason.go
Created March 7, 2015 19:22
13日の金曜日をjson形式で出力します
package main
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
)
@mizukmb
mizukmb / fizzbuzz.exs
Last active August 29, 2015 14:23
Written by Elixir
defmodule FizzBuzz do
def fizzbuzz(num) when rem(num, 15) == 0, do: "fizzbuzz"
def fizzbuzz(num) when rem(num, 3) == 0, do: "fizz"
def fizzbuzz(num) when rem(num, 5) == 0, do: "buzz"
def fizzbuzz(num), do: Integer.to_string num
end
Enum.each(1..100, fn(i) ->
IO.puts FizzBuzz.fizzbuzz(i)
end)
@mizukmb
mizukmb / private.xml
Created September 8, 2015 06:15
Setting file of KeyRemap4MacBook
<?xml version="1.0"?>
<root>
<item>
<name>For HHKB Pro2</name>
<item>
<name>Shift_R to Underscore for US Keyboard</name>
<identifier>remap.my_hhkb_us_shift_r_to_underscore</identifier>
<autogen>__KeyToKey__ KeyCode::SHIFT_R, ModifierFlag::SHIFT_R | ModifierFlag::NONE, KeyCode::MINUS, ModifierFlag::SHIFT_L</autogen>
<autogen>__KeyToKey__ KeyCode::SHIFT_R, ModifierFlag::SHIFT_L, KeyCode::MINUS, ModifierFlag::SHIFT_L</autogen>
</item>
@mizukmb
mizukmb / mdlink
Last active February 2, 2017 10:08
Create a markdown format link.
# coding: utf-8
from SPARQLWrapper import SPARQLWrapper, JSON
import pygraphviz as pgv
# sparql endpointの設定
sparql = SPARQLWrapper("http://ja.dbpedia.org/sparql")
sparql.setQuery("""
SELECT DISTINCT ?label ?iblabel
WHERE {
?s rdf:type dbpedia-owl:ProgrammingLanguage;
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Blog",
"alternativeHeadline": "{{ if not .IsHome }}{{ humanize .Title }} | {{ end }}{{ .Site.Title | plainify }}",
"url": "{{ .Site.BaseURL }}",
"image": "{{ .Site.BaseURL }}/images/mizukmb.png",
"author": {
"@type": "Person",
"name": "mizukmb",
class Nozaki
attr_reader :status
def initialize(status="嫌い")
@status = status
end
def 反対の
s = 好き? ^ true ? "好き" : "嫌い"
Nozaki.new(s)
#!/bin/bash
case "$1" in
-a|--all)
git branch --sort=-authordate -v -a | peco | sed -e 's/*/ /' | sed -e 's/ //' | cut -d ' ' -f1 | xargs git checkout
;;
-r|--remotes)
git branch --sort=-authordate -v -r | peco | sed -e 's/*/ /' | sed -e 's/ //' | cut -d ' ' -f1 | xargs git checkout
;;
*)
@mizukmb
mizukmb / float.rb
Last active February 7, 2017 12:21
# x.yE+-z 形式の浮動小数点定数を読み込む
# e.g 12.3E-1, .333E+3
class MzFloat
def initialize(num)
@chars = num.split('')
@index = 0
@ch = chars[index]
@sign = '+'
@b = 0