Harigami
ログイン
Harigamiは、ログイン不要のコード共有サービスです。コードの投稿後に発行されるURLでコードを共有できます。
PythonやRubyなど一部の言語は、投稿後にオンラインで実行することもできます。
誰でも無料で使えて、広告もありません。コードレビューやスニペットの代わりに使ってみてください。


詳細設定
+
anonymous タイトルなし
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"]];
	}
}
  • 0
  • 0
anonymous タイトルなし
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;
    }
}
  • 0
  • 1
anonymous タイトルなし
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;
    }
}
  • 0
  • 1
anonymous タイトルなし
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)
  • 0
  • 1
anonymous タイトルなし
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)
  • 0
  • 0
anonymous タイトルなし
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)
  • 0
  • 1
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;
}
  • 0
  • 1
anonymous タイトルなし
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>
  • 0
  • 1
anonymous タイトルなし
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)
  • 0
  • 1
anonymous タイトルなし
Python
//@version=3
strategy(title = "RCI3lines optimized", shorttitle = "RCI3lines opt") 

itvs = input(9, "short interval")
itvm = input(36, "middle interval")
itvl = input(52, "long interval")
src = input(close, "source")
res = input(9, "resolution", minval=9)
upperband=input(title="High line[%]",defval=80,type=integer)
lowerband=input(title="Low line[%]",defval=-80,type=integer)
dd = res * (res*res-1) / 100 

ord(seq, idx, itv) =>
    p = seq[idx]
    o = 1
    for i = 0 to res-1
        o := o + ((p < seq[i*itv]) ? 1 : 0)
    o

d(itv) =>
    sum = 0.0
    step = itv/res
    for i = 0 to res-1
        x = (i + 1) - ord(src, i*step, step)
        sum := sum + x*x
    sum

rci(itv) => sma(100.0 - 6.0 * d(itv) / dd, ceil(itv/res))
buy=crossover(lowerband,rci(itvs))
sel=crossunder(upperband,rci(itvs))
strategy.entry("buy",true,when=buy)
strategy.entry("sel",false,when=sel)

hline(upperband,color=gray,linestyle=dashed)
hline(lowerband,color=gray,linestyle=dashed)
plot(rci(itvs), title = "RCI short", color = red)
plot(rci(itvm), title = "RCI middle", color = blue)
plot(rci(itvl), title = "RCI long", color = green)
  • 0
  • 0