This file contains hidden or 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/sh | |
cat a.log | awk 'NR<=7 { if ( $1 ~ /^[0-9]+$/ ) { print$1 } }' | sort | uniq | wc -l |
This file contains hidden or 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
library(igraph) | |
#エッジ | |
d <- data.frame(read.delim( | |
"./relation.tsv", | |
sep="\t", | |
stringsAsFactors=FALSE, | |
header=FALSE, | |
na.strings="" | |
), stringsAsFactors=FALSE) |
This file contains hidden or 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
console.log(111); | |
// Deep copy | |
var logger = {}; | |
var test = $.extend(true, logger, console); | |
console.log(test); | |
test.log.apply(console, ['message']); | |
//test.log(222); | |
// Shallow copy | |
// var newObject = jQuery.extend({}, oldObject); |
This file contains hidden or 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 sys | |
import requests | |
import subprocess | |
def main(): | |
""" | |
guthub apiを使ってフォークしていないリポジトリをCloneし、 | |
アカウントと違うコミッターが含まれるリポジトリを残す。 | |
http://developer.github.com/v3/ |
This file contains hidden or 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/sh | |
git filter-branch --env-filter ' | |
an="$GIT_AUTHOR_NAME" | |
am="$GIT_AUTHOR_EMAIL" | |
cn="$GIT_COMMITTER_NAME" | |
cm="$GIT_COMMITTER_EMAIL" | |
if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ] |
This file contains hidden or 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 random | |
def my_insertion_sort(nums): | |
for i in range(len(nums)-1): | |
num = False | |
idx = -1 | |
target = i + 1 | |
for j in range(target): |
This file contains hidden or 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
import random | |
def my_selection_sort(nums): | |
l = len(nums) | |
for i in range(l): | |
min_idx = i | |
for j in range(i, l): | |
if (nums[min_idx] > nums[j]): | |
min_idx = j | |
nums[i], nums[min_idx] = nums[min_idx], nums[i] |
This file contains hidden or 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
<?php | |
$ary = range(1, 100000); | |
reset($ary); | |
echo "array create end\n"; | |
echo memory_get_usage() .PHP_EOL; | |
echo "while start\n"; | |
while (list($key, $value) = each($ary)) { | |
if ($key === 0) echo memory_get_usage() .PHP_EOL; |
This file contains hidden or 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
# % ruby -v | |
# ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0] | |
def func(x:[1]) | |
x << 1 | |
p x | |
end | |
func(x:[2]) # => [2, 1] | |
func() # => [1,1] |
This file contains hidden or 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
import time | |
range_end = 1000000 | |
search_val = range_end - 1 | |
my_list = range(1, range_end) | |
my_set = set(my_list) | |
my_dict = dict.fromkeys(my_list) | |
def test_list(): |