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
import os,re | |
from functools import reduce | |
def stroll(topdir,no_root=[],yes_root=[],no_path=[],yes_path=[],no_file=[],yes_file=[],sortby=os.path.basename,reverse=False,ignorecase=True): | |
T=True | |
F=False | |
I=ignorecase | |
no_root.append("\..") |
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
#include <iostream> | |
#include <algorithm> | |
#include <iterator> | |
#include <sys/stat.h> | |
#include <dirent.h> | |
#include <queue> | |
#include <regex> | |
namespace stroll { |
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
from collections import defaultdict | |
def init(data): | |
if isinstance(data, dict): | |
for key1, val1 in data.items(): | |
if isinstance(val1, dict): | |
for key2, val2 in val1.items(): | |
if isinstance(val2, dict): | |
for key3, val3 in val2.items(): |
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
git clone https://github.com/python/cpython | |
cd cpython | |
git pull | |
export $(grep ^PACKAGE_VERSION= configure)) | |
./configure --prefix=$HOME/.pyenv/versions/$PACKAGE_VERSION | |
make | |
make test | |
make install | |
ln -s $HOME/.pyenv/versions/$PACKAGE_VERSION/bin/python3 $HOME/.pyenv/versions/$PACKAGE_VERSION/bin/python | |
pyenv rehash |
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 | |
set -e | |
[ ${#@} -ne 2 ] && { | |
echo "Usage : $0 measurement_time(sec) bandwidth[|K|M](bps)" | |
echo "---" | |
echo "You also need to put 'hosts' file which contains target IPs." | |
exit 1 | |
} |
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 csv | |
import urllib3 | |
import matplotlib | |
import matplotlib.pyplot as plt | |
from matplotlib.font_manager import FontProperties | |
import pandas as pd |
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
import pandas as pd | |
import numpy as np | |
from collections import defaultdict | |
df1 = pd.DataFrame({"col1":[0,1,2,3],"col2":[4,5,6,7],"col3":[8,9,10,11]},index=["idx1","idx2","idx3","idx4"]) | |
print("df1") | |
print(df1,end="\n\n") | |
df2 = pd.DataFrame([[0,4,8],[1,5,9],[2,6,10],[3,7,11]],index=["idx1","idx2","idx3","idx4"],columns=["col1","col2","col3"]) |
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
import Data.List | |
import Debug.Trace | |
import Control.Applicative | |
testloop :: Integer -> Integer -> IO String | |
testloop n t | n>t = return "" | |
testloop n t = getLine >>= teststr >>= \x->return ("Case #"++(show n)++": "++x) >>= putStrLn >> testloop (n+1) t | |
teststr :: String -> IO String | |
teststr s = disp $ dropWhile check0to9 $ concatnums $ numlist 1 s |
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
import Debug.Trace | |
testloop :: Integer -> Integer -> IO String | |
testloop i t | i>t = return "" | |
testloop i t = getLine >>= testnum 0 >>= \x->return ("Case #"++(show i)++": "++x) >>= putStrLn >> testloop (i+1) t | |
testnum :: Integer -> String -> IO String | |
--testnum n s = flipcakes s >>= \x-> trace(x) (oneside n x) | |
testnum n s = case oneside n s of | |
Just n | any (=='+') s == True -> return $ show n |
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
import Data.Char | |
import GHC.Float | |
import Debug.Trace | |
testloop :: Int -> Int -> IO () | |
testloop i t | i>t = return () | |
--testloop i t = getLine >>= \x-> trace(x) (lineloop x) | |
testloop i t = getLine >>= lineloop >>= \x-> putStrLn ("Case #"++(show i)++":\n"++x) >> testloop (i+1) t | |
lineloop :: String -> IO String |