Share Code Quickly

What is Harigami?

Harigami is a simple source code sharing service. You can share source code by an URL which is issued after submission.
You can also run your source code online such as Python, Ruby, JavaScript and so on.
For free.Use for code review.
Preferences
anonymous ベルマンフォード
Python
INF = float('inf')


def Bellmanford(node, edges, source):
    d = [INF] * node  # ある頂点までのコストを保存するリスト
    d[source] = 0

    for i in range(node):
        for start, goal, cost in edges:
            # 辺の始まりの頂点までのコストが INF でなく
            # 辺の向かう先の頂点のコストが、より軽くなる場合に、
            # リストを更新する
            if d[start] != INF and d[start] + cost < d[goal]:
                d[goal] = d[start] + cost
                if i == node-1 and goal == node-1:
                    return 'inf'
    return -d[node-1]


N, M = map(int, input().split())
abc = [map(int, input().split()) for _ in range(M)]
Edges = [None] * M

for i in range(M):
    ai, bi, ci = abc[i]
    Edges[i] = (ai-1, bi-1, -ci)


ans = Bellmanford(N, Edges, 0)
print(ans)

anonymous No title
HTML
<div><a href="https://line.me/ti/p/uVKk2Tsspk" target="_blank" title=""><img alt="ジャパカジLINEはじめました!詳細ページへ" class="full hidden-xs" src="/images/home/images/line/japacasi-line-ad-header-pc_751x96.jpg" style="" /><img alt="ジャパカジLINEはじめました!詳細ページへ" class="full visible-xs" src="/images/home/images/line/japacasi-line-ad-header-mobile_351x89.jpg" style="" /></a></div>
anonymous No title
PHP
<?php echo 'sss'?>
anonymous No title
Python
//@version=3
study('コゲクラウド', overlay=true)
EMAorSMA = input(title="平均線の選択", defval="SMA", options=["SMA", "EMA"])
FAST= input(title="FASTMA", type=integer, defval=20, minval=1, maxval=10000)
SLOW = input(title="SLOWMA", type=integer, defval=80, minval=1, maxval=10000)
FASTMA = EMAorSMA == "EMA" ? ema(close, FAST) : sma(close, FAST)
SLOWMA = EMAorSMA == "EMA" ? ema(close, SLOW) : sma(close, SLOW)
ec = FASTMA > SLOWMA ? lime:red
plot(FASTMA, color=ec, linewidth=2)
plot(SLOWMA, color=ec, linewidth=2)
fill(plot(FASTMA), plot(SLOWMA), color = ec)
anonymous No title
Python
//@version=3
study('コゲクラウド', overlay=true)
EMAorSMA = input(title="EMA or SMA?", defval="SMA", options=["SMA", "EMA"])
FAST= input(title="MA Period Fast 1", type=integer, defval=20, minval=1, maxval=10000)
SLOW = input(title="MA Period Fast 2", type=integer, defval=80, minval=1, maxval=10000)
FASTMA = EMAorSMA == "EMA" ? ema(close, FAST) : sma(close, FAST)
SLOWMA = EMAorSMA == "EMA" ? ema(close, SLOW) : sma(close, SLOW)
ec = FASTMA > SLOWMA ? lime:red
plot(FASTMA, color=ec, linewidth=2)
plot(SLOWMA, color=ec, linewidth=2)
fill(plot(FASTMA), plot(SLOWMA), color = ec)
anonymous No title
Python
//@version=3
study(title = "BB GMMA")

source = hlc3
length = input(20, minval=1), mult = input(2.0, minval=0.001, maxval=50)
len = input(3, minval=1, title="FASTMA")
len2 = input(15, minval=1, title="FASTMA2")
len3 = input(30, minval=1, title="SLOWMA")
len4 = input(60, minval=1, title="SLOWMA2")
hiline = input(0.8, "HL")
lowline = input(0.2, "LL")
//RSI
rsi1 = rsi(source, length)

// BB of RSI
basis = sma(rsi1, length)
dev = mult * stdev(rsi1, length)
upper = basis + dev
lower = basis - dev
br = (rsi1 - lower)/(upper - lower)

//MA OF RSI
er = wma(br,len)
er2 = wma(br,len2)
er3 = wma(br,len3)
er4 = wma(br,len4)
//COLOR
plot(br, color=na)
plot(er, title="FMA", style=line, linewidth=1, color=lime,transp=10)
plot(er2, title="FMA2", style=line, linewidth=1, color=lime,transp=10)
plot(er3, title="SMA", style=line, linewidth=1, color=red,transp=10)
plot(er4, title="SMA2", style=line, linewidth=1, color=red,transp=10)
fill(plot(er), plot(er2), color = lime)
fill(plot(er3), plot(er4), color = red)
plot(hiline, title="HL",color=gray,style =circles,linewidth = 1)
plot(lowline, title="LL",color=gray,style =circles,linewidth = 1)
anonymous No title
Python
//@version=3

study(title = "BBRSI", shorttitle = "BSI")

source = hlc3
length = input(20, minval=1), multi = input(2.0, minval=0.001,title="シグマ", maxval=50)
len = input(20, minval=1, title="移動平均線")

//RSI
rsi1 = rsi(source, length)

// BB of RSI
basis = sma(rsi1, length)
dev = multi * stdev(rsi1, length)
upper = basis + dev
lower = basis - dev
br = (rsi1 - lower)/(upper - lower)

//MA OF RSI
er = sma(br,len)

//COLOR
plot(br, color=aqua)
hb = hline(1, color=silver, linestyle=dashed)
lb = hline(0, color=silver, linestyle=dashed)
fill(hb, lb, color=green,transp=95)
plot(er, title="MA", style=circles, linewidth=1, color=orange)


anonymous ビット演算でフラグ管理をする
Python
state = 0b0000  # 初期状態

sleep = 0b0001  # 眠り
poison = 0b0010  # 毒
paralysis = 0b0100  # 麻痺
excitation = 0b1000  # 励起


# 眠り状態か判別
def isSleep(state):
    if state & 0b0001:
        return 'Sleep'
    else:
        return 'Not Sleep'


# 眠り状態にする
state = state | sleep
print(isSleep(state))

# 眠り状態を解く
state = state & ~ sleep
print(isSleep(state))
anonymous No title
Python
if true:
    print('Hello, World')
anonymous No title
HTML
          <div class="col-md-3 col-xs-6 text-center animate-box">
            <div class="profile inline_popup" style="background-image: url(http://placehold.it/200x360?text=ここ変える);" data-mfp-src="#inline-popup1"><span></span></div>
            <div id="inline-popup1" class="mfp-hide">
              <div class="prof">
                <figuer class="prof_image"><img src="http://placehold.it/200x360?text=ここ変える" alt=""></figuer>
                <ul class="prof_list">
                  <li class="prof_name">名前.1</li>
                  <li class="prof_position">役所</li>
                  <li class="prof_info">ダミーテキストダミーテキストダミーテキストダミーテキストダミーテキストダミーテキスト</li>
                </ul>
              </div>
            </div>
          </div>