View gist:b85cb780fb349647654436645f1f03af
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f | grep "\.cpp$" | xargs -t -I{} sh -c "iconv -f cp932 -t utf8 {} > {}.utf8.cpp" |
View Camel2SnakeAndSnake2Camel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
static private let SNAKECASE_PATTERN:String = "(\\w{0,1})_" | |
static private let CAMELCASE_PATTERN:String = "[A-Z][a-z,\\d]*" | |
func snake_caseToCamelCase() -> String{ | |
let buf:NSString = self.capitalized.replacingOccurrences( of: String.SNAKECASE_PATTERN, | |
with: "$1", | |
options: .regularExpression, | |
range: nil) as NSString | |
return buf.replacingCharacters(in: NSMakeRange(0,1), with: buf.substring(to: 1).lowercased()) as String | |
} |
View magicsquare.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.stdin.resume(); | |
process.stdin.setEncoding('utf8'); | |
// 自分の得意な言語で | |
// Let's チャレンジ!! | |
function createPermutation(inputArray) { | |
if(inputArray.length===1) return [[inputArray[0]]]; | |
var result = []; | |
for(var index=0; index<inputArray.length; index++) { | |
let cloneArray = inputArray.concat([]); | |
let head = cloneArray.splice(index,1); |
View opencv_colorpicker.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# USAGE | |
# opencv_colorpicker.py | |
# import the necessary packages | |
from Tkinter import Tk | |
from Tkinter import * | |
from PIL import Image | |
from PIL import ImageTk | |
import tkFileDialog |
View binary_tree_iterator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
import numpy as np | |
# [問題] | |
# | |
# 以下の表はそのマスとその周囲8マスに含まれている爆弾の個数を表しています。フィールドに含まれている爆弾の位置を(x,y)としたとき、 | |
# その積k(=x*y)が小さい順にアルファベットを並べるとある単語が完成します。 | |
field_data = np.array([ | |
[[1, 'i'], [2, 'p'], [2, 'a'], [1, 'g'], [1, 'x'], [1, 'u']], |
View matplot_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
import numpy as np | |
import matplotlib | |
matplotlib.use('TkAgg') | |
import matplotlib.pyplot as plt | |
import pylab | |
np.random.seed(0) |
View update_r53_local.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
ZONE_NAME=XXXXXXXX.local | |
HOSTED_ZONE_ID=/hostedzone/XXXXXXXXXXXXXX | |
FILEBUF=r53_local.json | |
FLG=0 | |
PRIVATE_ADDRESS_TABLE=$(aws ec2 describe-instances | jq -r '.Reservations[].Instances[]|{InstanceName: (.Tags[]|select(.Key=="Name").Value),PrivateIpAddress}|[.InstanceName, .PrivateIpAddress]|@csv') |