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 No title
Python
//@version=3
study(title="虹RSI-EMA-GMMA", overlay=false)
src = close, 
len0 = input(14, minval=1, title="RSI Length")
len = input(3, minval=1, title="MA")
len2 = input(5, minval=1, title="MA2")
len3 = input(8, minval=1, title="MA3")
len4 = input(10, minval=1, title="MA4")
len5 = input(12, minval=1, title="MA5")
len6 = input(15, minval=1, title="MA6")
len7 = input(30, minval=1, title="MA7")
len8 = input(35, minval=1, title="MA8")
len9 = input(40, minval=1, title="MA9")
len10 = input(45, minval=1, title="MA10")
len11 = input(50, minval=1, title="MA11")
len12 = input(60, minval=1, title="MA12")
up = rma(max(change(src), 0), len0)
down = rma(-min(change(src), 0), len0)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
er = ema(rsi,len)
er2 = ema(rsi,len2)
er3 = sma(rsi,len3)
er4 = ema(rsi,len4)
er5 = ema(rsi,len5)
er6 = ema(rsi,len6)
er7 = ema(rsi,len7)
er8 = ema(rsi,len8)
er9 = ema(rsi,len9)
er10 = ema(rsi,len10)
er11 = ema(rsi,len11)
er12 = ema(rsi,len12)


plot(er, title="MA", style=line, linewidth=1, color=yellow,transp=10)
plot(er2, title="MA2", style=line, linewidth=1, color=orange,transp=10)
plot(er3, title="MA3", style=line, linewidth=1, color=red,transp=10)
plot(er4, title="MA4", style=line, linewidth=1, color=maroon,transp=10)
plot(er5, title="MA5", style=line, linewidth=1, color=fuchsia,transp=10)
plot(er6, title="MA6", style=line, linewidth=1, color=purple,transp=10)
plot(er7, title="MA7", style=line, linewidth=1, color=navy,transp=10)
plot(er8, title="MA8", style=line, linewidth=1, color=blue,transp=10)
plot(er9, title="MA9", style=line, linewidth=1, color=aqua,transp=10)
plot(er10, title="MA10", style=line, linewidth=1, color=teal,transp=10)
plot(er11, title="MA11", style=line, linewidth=1, color=lime,transp=10)
plot(er12, title="MA12", style=line, linewidth=1, color=green,transp=10)
band1 = hline(70, title="Upper Line", linestyle=dashed, linewidth=1, color=gray)
band0 = hline(30, title="Lower Line", linestyle=dashed, linewidth=1, color=gray)
fill(band1, band0, color=purple, transp=90)


anonymous No title
ObjectiveC
- (void)twitter
{
	UIApplication *app = [UIApplication sharedApplication];
	if ([app canOpenURL:[NSURL URLWithString:@"twitter://user?screen_name=ray__kisaragi"]]) {
		[app openURL:[NSURL URLWithString:@"twitter://user?screen_name=ray__kisaragi"]];
	} else if ([app canOpenURL:[NSURL URLWithString:@"tweetbot:///user_profile/ray__kisaragi"]]) {
		[app openURL:[NSURL URLWithString:@"tweetbot:///user_profile/ray__kisaragi"]];		
	} else {
		[app openURL:[NSURL URLWithString:@"https://mobile.twitter.com/ray__kisaragi"]];
	}
}
anonymous No title
Python
static BOOL enabled;

#define PREF_PATH @"/var/mobile/Library/Preferences/com.rowl.avoidance.plist"

static void loadPrefs()
{
	NSDictionary *prefs = [NSDictionary dictionaryWithContentsOfFile:PREF_PATH];
	
    enabled = [prefs objectForKey:@"enabled"] ? [[prefs objectForKey:@"enabled"] boolValue] : NO;

}

%hook FuseSDK
-(bool)isJailBroken {
        if (enabled) {
            return FALSE;
        } else {
            return %orig;
    } 
}
%end

%hook FIRInstanceIDCheckinPreferences
-(id)deviceID {
    if (enabled) {
        return (NULL);
        } else {
            return %orig;
    }
}
%end

%hook USParametersProvider
-(id)isJailbroken {
    if (enabled) {
        return (NULL);
        } else {
            return %orig;
    }
}
%end

%hook MATUtils
+(bool)checkJailBreakn {
    if (enabled) {
        return FALSE;
        } else {
            return %orig;
    }
}
%end

%hook LCNotificationValidateBase
-(bool)isValidVersionsCheck {
    if (enabled) {
        return FALSE;
        } else {
            return %orig;
    }
}
%end

%ctor 
{
    @autoreleasepool {
        loadPrefs();
        %init;
    }
}
anonymous No title
ObjectiveC
static BOOL enabled;
static BOOL textEnabled;

static float bgred;
static float bggreen;
static float bgblue;
static float bgalpha;

static float txred;
static float txgreen;
static float txblue;
static float txalpha;

#define PREF_PATH @"/var/mobile/Library/Preferences/com.rowl.filzatheme1b.plist"

static void loadPrefs()
{
	NSDictionary *prefs = [NSDictionary dictionaryWithContentsOfFile:PREF_PATH];
	
    enabled = [prefs objectForKey:@"enabled"] ? [[prefs objectForKey:@"enabled"] boolValue] : NO;

    textEnabled = [prefs objectForKey:@"textEnabled"] ? [[prefs objectForKey:@"textEnabled"] boolValue] : NO;



    bgred = [prefs objectForKey:@"bgred"] ? [[prefs objectForKey:@"bgred"] floatValue] : 255.0;

    bggreen = [prefs objectForKey:@"bggreen"] ? [[prefs objectForKey:@"bggreen"] floatValue] : 255.0;

    bgblue = [prefs objectForKey:@"bgblue"] ? [[prefs objectForKey:@"bgblue"] floatValue] : 255.0;

    bgalpha = [prefs objectForKey:@"bgalpha"] ? [[prefs objectForKey:@"bgalpha"] floatValue] : 255.0;



    txred = [prefs objectForKey:@"txred"] ? [[prefs objectForKey:@"txred"] floatValue] : 255.0;

    txgreen = [prefs objectForKey:@"txgreen"] ? [[prefs objectForKey:@"txgreen"] floatValue] : 255.0;

    txblue = [prefs objectForKey:@"txblue"] ? [[prefs objectForKey:@"txblue"] floatValue] : 255.0;

    txalpha = [prefs objectForKey:@"txalpha"] ? [[prefs objectForKey:@"txalpha"] floatValue] : 255.0;
}

%hook ThemeManager
-(id)background {
        if (enabled) {
            return [UIColor 
                colorWithRed:bgred/255.0 
                               green:bggreen/255.0 
                                  blue:bgblue/255.0 
                                alpha:bgalpha/255.0];
        } else {
            return %orig;
    } 
}


- (id)text {
    if (textEnabled) {
        return [UIColor 
            colorWithRed:txred/255.0 
                           green:txgreen/255.0 
                              blue:txblue/255.0 
                            alpha:txalpha/255.0];
        } else {
            return %orig;
    }
}
%end

%ctor 
{
    @autoreleasepool {
        loadPrefs();
        %init;
    }
}
anonymous No title
Python
//@version=3
study('コゲクラウドDMA零式', overlay=true)
//クラウド
EMAorSMA = input(title="平均線の選択", defval="SMA", options=["SMA", "EMA"])
FAST= input(title="先行スパン1", type=integer, defval=20, minval=1, maxval=10000)
SLOW = input(title="先行スパン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)
displacement = input(26, minval=1,title="遅行線")
off = input(20, title="シフト")
len1=input(9, title="転換線")
len2=input(20, title="基準線")
upper1 = highest(len1)
lower1= lowest(len1)
upper2 = highest(len2)
lower2= lowest(len2)
basis1= avg(upper1, lower1)
basis2= avg(upper2, lower2)
//カラー等
ec = FASTMA > SLOWMA ? lime:red
plot(FASTMA, color=ec, linewidth=2, offset = off)
plot(SLOWMA, color=ec, linewidth=2, offset = off)
ec2 = basis1 > basis2 ? green:purple
fill(plot(FASTMA, offset = off), plot(SLOWMA, offset = off), color = ec)
plot(close,offset=-displacement, color=aqua, title="遅行スパン")
plot(basis1,color=ec2,transp=5)
plot(basis2,color=ec2,transp=5)
anonymous No title
Python
//@version=3
study('コゲクラウドDMA零式', overlay=true)
//クラウド
EMAorSMA = input(title="平均線の選択", defval="SMA", options=["SMA", "EMA"])
FAST= input(title="先行スパン1", type=integer, defval=20, minval=1, maxval=10000)
SLOW = input(title="先行スパン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)
displacement = input(26, minval=1,title="遅行線")
off = input(20, title="シフト")
len1=input(9, title="転換線")
len2=input(20, title="基準線")
upper1 = highest(len1)
lower1= lowest(len1)
upper2 = highest(len2)
lower2= lowest(len2)
basis1= avg(upper1, lower1)
basis2= avg(upper2, lower2)
//カラー等
ec = FASTMA > SLOWMA ? lime:red
plot(FASTMA, color=ec, linewidth=2, offset = off)
plot(SLOWMA, color=ec, linewidth=2, offset = off)
ec2 = basis1 > basis2 ? green:purple
fill(plot(FASTMA, offset = off), plot(SLOWMA, offset = off), color = ec)
plot(close,offset=-displacement, color=aqua, title="遅行スパン")
plot(basis1,color=ec2,transp=5)
plot(basis2,color=ec2,transp=5)
anonymous No title
Python
//@version=3
study('コゲクラウドDMA零式', 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)
displacement = input(26, minval=1,title="遅行線")
//高値安値
len1=input(9, title="FAST-HL")
len2=input(26, title="SLOW-HL")
upper1 = highest(len1)
lower1= lowest(len1)
upper2 = highest(len2)
lower2= lowest(len2)
basis1= avg(upper1, lower1)
basis2= avg(upper2, lower2)
//カラー等
off = input(26, title="シフト")
ec = FASTMA > SLOWMA ? lime:red
plot(FASTMA, color=ec, linewidth=2, offset = off+1)
plot(SLOWMA, color=ec, linewidth=2, offset = off+1)
ec2 = basis1 > basis2 ? green:purple
fill(plot(FASTMA, offset = off+1), plot(SLOWMA, offset = off+1), color = ec)
plot(close,offset=-displacement+1, color=aqua, title="遅行スパン")
plot(basis1,color=ec2,transp=5)
plot(basis2,color=ec2,transp=5)
anonymous template
C++
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define step(i,s,n,c) for(int i=(s);i<(n);i+=(c))
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define each(i,vec) for(auto i:vec)
#define cinv(n,vec) VL vec(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define eb emplace_back
#define m_p make_pair
#define m_t make_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a),greater<>())
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (signed)(a.size())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define callp(a) for(auto [k,v]:a)cout<<k<<":"<<v<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define ENDL cout<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define PQ priority_queue
#define cont const auto
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
const signed INF = (1LL<<30);
const long long MOD = (1e9+7);
const long long LINF = (1LL<<60);
const long long LMAX = LLONG_MAX;
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  
  
  
  
  return 0;
}
anonymous No title
HTML
<!DOCTYPE html>
<html lang="ja">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <title>microbitからGooglehomeへ</title>
    <script type="text/javascript" src="microbit.js"></script>
    <link rel="stylesheet" type="text/css" href="main.css">
    <style>
        body {
            background-color: rgba(255, 254, 225, 0.603);
        }

        #a_button,
        #b_button {
            margin: 60px auto 0px auto;
            font-size: 200px;
            color: rgb(220, 220, 220);
            text-align: center;
            font-weight: bold;
            line-height: 260px;
        }

        #select {
            padding: 0 0 0 60px;
            font-size: 35px;
            color: rgb(255, 230, 0);
            line-height: 80px;
            margin: 0;
            font-family: "UD デジタル 教科書体 NK-B", "UD Digi Kyokasho NK-B";
        }

        button {
            height: 50px;
            width: 90px;
            color: white;
            border-radius: 10px;
            font-size: 20px;
            box-shadow: rgb(139, 139, 139) 2px 2px 3px;
            border: rgb(102, 102, 102) 1px solid;
        }

        .con {
            background-color: rgb(47, 165, 11);
        }

        .discon {
            background-color: rgb(226, 19, 19);
        }

        .textAria {
            margin: 40px auto;
            border: rgb(126, 53, 19) solid 5px;
            background-color: rgb(53, 77, 62);
            border-radius: 20px;
            width: 80%;
            height: 80px;
        }

        .ABAria {
            margin: 20px auto;
            border: rgb(79, 143, 82) dashed 6px;
            background-color: rgb(241, 250, 223);
            border-radius: 20px;
            width: 80%;
            height: 400px;
        }

        .A {
            width: 50%;
            float: left;
        }

        .B {
            width: 50%;
            float: left;
        }

        .text {
            text-align: center;
            font-size: 40px;
            margin: 0;
            font-family: "UD デジタル 教科書体 NK-B", "UD Digi Kyokasho NK-B";
        }
    </style>
    <script>
        // 接続するBluetoothデバイス
        var targetDevice = null;

        // ボタンサービス
        const BUTTON_SERVICE = "e95d9882-251d-470a-a062-fa1922dfa9a8";
        // Aボタンキャラクタリスティック
        const BUTTON_A_DATA = "e95dda90-251d-470a-a062-fa1922dfa9a8";
        // Bボタンキャラクタリスティック
        const BUTTON_B_DATA = "e95dda91-251d-470a-a062-fa1922dfa9a8";

        //Bluetoothがサポートしているか?
        function onClickStartButton() {
            if (!navigator.bluetooth) {
                alert("Web Bluetooth is not supported.")
                return;
            }
            connect();
        }

        function onClickStopButton() {
            if (!navigator.bluetooth) {
                alert("Web Bluetooth is not supported.")
                return;
            }
            disconnect();
        }


        //-------------------------------------------------接続処理-----------------------------------------
        function connect() {
            navigator.bluetooth.requestDevice({
                filters: [
                    { services: [BUTTON_SERVICE] },
                    { namePrefix: "BBC micro:bit" }
                ]
            })
                .then(device => {
                    targetDevice = device;
                    return device.gatt.connect();
                })
                .then(server => {
                    getservice(server);
                })
                .catch(error => {
                    alert(error);
                });
        }


        //--------------------------------------------サービスの取得----------------------------------------
        function getservice(server) {
            server.getPrimaryService(BUTTON_SERVICE)
                .then(service => {
                    charaA(service);
                    charaB(service);
                    if (message[count].match(/http:\/\/192.168.0.0/)) {
                        document.getElementById("select").innerHTML = (count + 1) + '. {' + message[count].replace('http://192.168.0.0/', '') + 'を再生}';
                    } else {
                        document.getElementById("select").innerHTML = (count + 1) + '. ' + message[count];
                    }
                })
                .catch(error => {
                    alert(error);
                });
        }

        //---------------------------------------------ボタンAについて取得--------------------------------------------------
        function charaA(service) {
            service.getCharacteristic(BUTTON_A_DATA)
                .then(characteristic => {
                    return characteristic.startNotifications();
                })
                .then(char => {
                    char.addEventListener('characteristicvaluechanged',
                        onButtonAChanged);
                })
                .catch(error => {
                    alert(error);
                });
        }

        function onButtonAChanged(event) {
            let state = event.target.value.getUint8(0, true);
            updateButtonState("a_button", state);
        }


        //---------------------------------------------ボタンBについて取得---------------------------------------------------------
        function charaB(service) {
            service.getCharacteristic(BUTTON_B_DATA)
                .then(characteristic => {
                    return characteristic.startNotifications();
                })
                .then(char => {
                    char.addEventListener('characteristicvaluechanged',
                        onButtonBChanged);
                })
                .catch(error => {
                    alert(error);
                });
        }

        function onButtonBChanged(event) {
            let state = event.target.value.getUint8(0, true);
            updateButtonState("b_button", state);
        }


        //-----------------------------------------------押されたときの処理----------------------------------------------------------
        // メッセージの内容
        var count = 0;
        var message = ['ご飯できたよ?', 'おやすみなさい', 'いってきます', 'http://192.168.0.0/xxxxxx.mp3', 'http://192.168.0.0/xxxxxxx.mp3', 'http://192.168.0.0/xxxxx.mp3'];


        // ボタンの状態を表示する
        function updateButtonState(buttonName, state) {
            var text = document.getElementById(buttonName);

            switch (state) {
                case 0: //ボタンが押されていない(0)
                    text.style.color = "rgb(200, 200, 200)";
                    break;


                case 1: //ボタンが押されている(1)
                    text.style.color = "black";

                    /* Aボタンが押されたらPOST処理 */
                    if (buttonName == "a_button") {
                        var url = 'https://00000000.ngrok.io/google-home-notifier';
                        var data = 'text=' + message[count]; //'param=value&...'
                        var webrequest = new XMLHttpRequest();
                        webrequest.open('POST', url);
                        webrequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                        webrequest.send(data);
                    }

                    /* Bボタンが押されたらmessage変更 */
                    if (buttonName == "b_button") {
                        if (count < message.length - 1) {
                            count++
                        } else {
                            count = 0;
                        }
                        if (message[count].match(/http:\/\/192.168.0.0/)) {
                            document.getElementById("select").innerHTML = (count + 1) + '. {' + message[count].replace('http://192.168.0.0/', '') + 'を再生}';
                        } else {
                            document.getElementById("select").innerHTML = (count + 1) + '. ' + message[count];
                        }
                    }
                    break;


                case 2:  //ボタンが長押しされている(2)
                    break;
            }
        }

        //切断処理
        function disconnect() {
            if (targetDevice == null) {
                alert('target device is null.');
                return;
            }
            targetDevice.gatt.disconnect();
        }
    </script>
</head>

<body>
    <button class="con" onClick="onClickStartButton()">Start</button>
    <button class="discon" onClick="onClickStopButton()">Stop</button>

    <div class="textAria">
        <p id="select">
            <script></script>
        </p>
    </div>
    <div class="ABAria">
        <div class="A">
            <p id="a_button">A</p>
            <p class="text">~送信~</p>
        </div>
        <div class="B">
            <p id="b_button">B</p>
            <p class="text">~変更~</p>
        </div>

    </div>



</body>
anonymous No title
Python
//@version=3

strategy(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)
//ENTRY条件
LONG = crossover(br,er)
SHORT = crossunder(br,er)
strategy.entry("LONG",true,when=LONG)
strategy.entry("SHORT",false,when=SHORT)

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