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
Gооd dаy! 
I have just checked harigami.jp for the ranking keywords and seen that your SEO metrics could use a boost. 
 
We will improve your SEO metrics and ranks organically and safely, using only whitehat methods, while providing monthly reports and outstanding support. 
 
Please check our pricelist here, we offer SEO at cheap rates. 
https://www.hilkom-digital.de/cheap-seo-packages/ 
 
Start increasing your sales and leads with us, today! 
 
regards 
Hilkom Digital Team 
support@hilkom-digital.de
anonymous No title
Java
public class Score{
    private int score = 0;

    Score(int score){
        this.score = score;
    }

    Score(){
    }

    public void setScore(int score) {
        if (score >= 0 && score <= 100){
            this.score = score;
        }
    }
    public int getScore(){
        return score;
    }
    public void showResult(String person){
        System.out.println(person+"さんの点数:"+score);
    }

}
anonymous No title
Python
import clipboard
import keyboard
import datetime
import sched
import tweepy
import json
import time
import sys
import re

# ルーム番号 
roomid ="721"
# 時間
passtime = "03"

username = clipboard.get()
password  = ""
consumerkey = "o1ngUiKknAOSx0n8TIgTxytvP"
consumersecret = "92ZuHtI0aSRTLRbCv7pIBtLPwoQOBxjmo1ky3r9pio68IVoPB6"
accesstoken = "995417605727899648-7ymelPbr6xt1nul2ceUwd2B0sRbK0ux"
accesstokensecret = "YwYZcUHeFMF84o1kFh3IvqBOxpf3RvfRD2ILn6yIDcTw9"

Auth = tweepy.OAuthHandler(consumerkey,consumersecret)
Auth.set_access_token(accesstoken,accesstokensecret)
Api = tweepy.API(Auth)

now   = datetime.datetime.now()
minute = now.minute

if("/" in str(username)):
	username = username.split("/")
	username = username[3].split("?")
	username = username[0]
else:
	print("リンクをコピーしてください")
	sys.exit()
for _ in range(900):  
  for _	 in range(900) :
    for i, status in enumerate(tweepy.Cursor(Api.user_timeline,id=username,tweet_mode="extended").items(1)):
    	tweettime = re.findall(r"\d+",str(status.created_at))
    	if( '@' in status.full_text ):
    	  moto = status.full_text
    	  co = moto.index('@')
    	  kore = list(moto)
    	  del kore[co:]
    	  status.full_ta = ''.join(kore)
    	  tweet = re.findall(r"\d+",status.full_ta)
    	else:
  	    tweet = re.findall(r"\d+",status.full_text)

    tweet0 = ''.join(tweet)
    tweet1 = re.findall(r"\d",tweet0) 
  
    if(passtime in tweettime):
    	print("パスワード!")
    else:
    	print("更新中")
    	time.sleep(0.0001)
    	break
  	
    if( roomid in tweet0 ):
      keyboard.insert_text(tweet[1])
      keyboard.insert_text("\n")
      print("password:"+tweet[1])
      sys.exit()
    else:
       keyboard.insert_text(tweet[0])
       keyboard.insert_text("\n")
       print("password:"+tweet[0])
       sys.exit()   
       
anonymous No title
PHP
<?php
session_start();
$_SESSION = array();
session_destroy();
?>

<!DOCTYPE html>
<html>
<head>
<title>ログアウト</title>
</head>
<body>
<h1>
<font size='5'>ログアウトしました</font>
</h1>
<p><a href='http://co-19-271.99sv-coco.com/kadai3_2_login.php'>ログインページに戻る</a></p>
</body>
</html>
anonymous No title
PHP
<?php
if(isset($_POST['login'])){
    if(strlen($_POST['user_id']) && strlen($_POST['password'])){
        session_start();
        $user_id = $_POST['user_id'];
        $password = $_POST['password'];
        $pdo = new PDO('mysql:host=localhost;dbname=co_19_271_99sv_coco_com', 'co-19-271.99sv-c', 'Xc5tnWDA');
        $stmt = $pdo->prepare('SELECT * FROM kadai3_1_users WHERE id = :id');
        $stmt->bindValue(':id', $user_id);
        $stmt->execute();
        $member = $stmt->fetch();
        if(strcmp($member['password'], $password) == 0){
            $_SESSION['user_id'] = $user_id;
            $_SESSION['name'] = $member['name'];
            $_SESSION['password'] = $password;
            header("Location: http://co-19-271.99sv-coco.com/kadai3_2_top.php");
        }else{
            echo 'IDかパスワードが間違っています<br/>';
        }
    }else{
        echo "未入力の欄があります<br/>";
    }
}

?>

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ログイン</title>
</head>
<body>
    <h1>ログイン</h1>
    <form action="kadai3_2_login.php" method="post">
    <p>ID</p>
    <input type = "text" name ="user_id"><br/>
    <p>パスワード</p>
    <input type = "text" name ="password"><br/>
    <input type = "submit" name="login" value ="送信"><br/>
    </form>
    <a href="http://co-19-271.99sv-coco.com/kadai3_2_signup.php">新規登録</a>
</body>
</html>
anonymous No title
PHP
<?php
session_start();
$pdo = new PDO('mysql:host=localhost;dbname=co_19_271_99sv_coco_com', 'co-19-271.99sv-c', 'Xc5tnWDA');
$pdo->query('CREATE TABLE IF NOT EXISTS post_table_apply (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(20),
    comment TEXT,
    date DATE,
    password VARCHAR(20)
    )');
if(!isset($_SESSION['user_id'])){
    header("Location: http://co-19-271.99sv-coco.com/kadai3_2_login.php");
    exit;
}else{
    echo 'ログイン済み<br/>';
    echo "あなたのID: ".$_SESSION['user_id']."<br/>";
    $name = $_SESSION['name'];
    echo "あなたの名前: ".$name."<br/><br/>";
}

if(isset($_POST['edit']) && isset($_POST['password'])){
    if(strlen($_POST['edit']) && strlen($_POST['password'])){
        $password = $_POST['password'];
        $stmt = $pdo->prepare('SELECT * FROM post_table_apply WHERE id = :id');
        $stmt->execute(array(':id' => $_POST['edit']));
        $edit_post = $stmt->fetch(PDO::FETCH_ASSOC);
        if($edit_post['password'] == $password){
            $edit_id = $_POST['edit'];
            $edit_name = $edit_post['name'];
            $edit_txt = $edit_post['comment'];
        }else{
            echo "編集パスワードが間違っています<br/>";
        }
    }else{
        echo "編集番号かパスワードが空欄になっています<br/>";
    }
}

if(isset($_POST['delete']) && isset($_POST['password'])){
    if(strlen($_POST['delete']) && strlen($_POST['password'])){
        $delete_id = $_POST['delete'];
        $password = $_POST['password'];
        $stmt = $pdo->prepare('SELECT * FROM post_table_apply WHERE id = :id');
        $stmt->execute(array(':id' => $delete_id));
        $delete_post = $stmt->fetch(PDO::FETCH_ASSOC);
        if($delete_post['password'] == $password){
            $stmt = $pdo->prepare('DELETE FROM post_table_apply WHERE id=:id');
            $stmt->execute(array(':id' => $delete_id));
            echo $delete_id."番の投稿を削除しました<br/>";
        }else{
            echo "削除パスワードが間違っています<br/>";
        }
    }else{
        echo "削除番号かパスワードが空欄になっています<br/>";
    }
}

if(isset($_POST['comment']) && isset($_POST['name']) && isset($_POST['password'])){
    if(strlen($_POST['comment']) && strlen($_POST['name']) && strlen($_POST['password'])){
        $comment = $_POST['comment'];
        $name = $_POST['name'];
        $password = $_POST['password'];
        $date = date("Y-m-d");
        $stmt = $pdo->prepare('INSERT INTO post_table_apply (name, comment, date, password) VALUES (:name, :comment, :date, :password)');
        $flag = $stmt->execute(array(':name' => $name, ':comment' => $comment, ':date' => $date, ':password' => $password));
        if ($flag){
            print('投稿しました<br>');
        }else{
            print('投稿に失敗しました<br>');
        }
    }else{
        echo "未入力の欄があります<br/>";
    }
}elseif(isset($_POST['comment']) && isset($_POST['name']) && isset($_POST['edit_id'])){
    if(strlen($_POST['comment']) && strlen($_POST['name']) && strlen($_POST['edit_id'])){
        $comment = $_POST['comment'];
        $name = $_POST['name'];
        $date = date("Y-m-d");
        $edit_id = $_POST['edit_id'];
        $stmt = $pdo->prepare("UPDATE post_table_apply SET name = :name, comment = :comment, date = :date WHERE id = :id");
        $stmt->execute(array(':name' => $name, ':comment' => $comment, ':date' => $date, ':id' => $edit_id));
        $edit_id = -10000;
    }else{
        echo "未入力の欄があります<br/>";
    }
}

echo "投稿一覧<br/>";
$result_rows = $pdo->query('SELECT * FROM post_table_apply');
foreach ( $result_rows as $row ) {
    echo "{$row['id']}";
    echo " {$row['name']}";
    echo " {$row['comment']}";
    echo " {$row['date']}";
    echo "<br/>";
}
echo "<br/>";
?>
<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>投稿</title>
</head>
<body>
    <h1>投稿フォーム</h1>
    <form action="kadai3_2_top.php" method="post">
    <p>名前</p>
    <input type = "text" name ="name" value=<?php echo $name; ?> readonly>
    <p>コメント</p>
    <input type = "text" name ="comment" value="<?php if(isset($edit_txt)){echo $edit_txt;} ?>"><br/>
    <?php if(!isset($edit_id) || $edit_id == -10000){
    ?>
        <p>パスワード</p>
        <input type = "text" name ="password"><br/>
    <?php
    }
    ?>
    <input type="hidden" name ="edit_id" value="<?php if(isset($edit_id)){echo $edit_id;} ?>">
    <input type = "submit" value ="送信">
    </form>
    <script>
    function delete_confirm() {
            var select = confirm("削除してよろしいですか?");
            return select;
    }
    </script>
    <h1>削除</h1>
    <p>削除する投稿の番号</p>
    <form action="kadai3_2_top.php" method="post" onsubmit="return delete_confirm()">
    <input type = "text" name ="delete"><br/>
    <p>パスワード</p>
    <input type = "text" name ="password"><br/>
    <input type = "submit" value ="送信">
    </form>
    <h1>編集</h1>
    <p>編集する投稿の番号</p>
    <form action="kadai3_2_top.php" method="post">
    <input type = "text" name ="edit"><br/>
    <p>パスワード</p>
    <input type = "text" name ="password"><br/>
    <input type = "submit" value ="送信"><br/>
    <a href="http://co-19-271.99sv-coco.com/kadai3_2_signup.php">新規登録</a>
    </form>
</body>
</html>
anonymous No title
PHP
<?php
$pdo = new PDO('mysql:host=localhost;dbname=co_19_271_99sv_coco_com', 'co-19-271.99sv-c', 'Xc5tnWDA');
$pdo->query('CREATE TABLE IF NOT EXISTS kadai3_1_users (
    id INT(5) AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(20),
    password VARCHAR(20)
    )');

if(isset($_POST['name']) && isset($_POST['password'])){
    if(strlen($_POST['name']) && strlen($_POST['password'])){
        $name = $_POST['name'];
        $password = $_POST['password'];
        $stmt = $pdo->prepare('INSERT INTO kadai3_1_users (name, password) VALUES (:name, :password)');
        $flag = $stmt->execute(array(':name' => $name, ':password' => $password));
        $user_id = $pdo->lastinsertid();
        if ($flag){
            print('ユーザー登録が完了しました<br>');
            echo 'あなたのユーザー情報<br/>';
            echo "ID: ".$user_id;
            echo "<br/>";
            echo "名前: ".$name;
            echo "<br/>";
            echo "パスワード: ".$password;
            echo "<br/>";
            echo "<br/>";
        }else{
            print('ユーザー登録に失敗しました<br>');
        }
    }else{
        echo '未入力の項目があります<br/>';
    }
}

echo "ユーザー一覧<br/>";
$result_rows = $pdo->query('SELECT * FROM kadai3_1_users');
foreach ( $result_rows as $row ) {
    echo "{$row['id']}";
    echo " {$row['name']}";
    echo "<br/>";
}
echo "<br/>";

?>

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新規登録</title>
</head>
<body>
    <h1>新規登録フォーム</h1>
    <form action="kadai3_2_signup.php" method="post">
    <p>名前</p>
    <input type = "text" name ="name"><br/>
    <p>パスワード</p>
    <input type = "text" name ="password"><br/>
    <input type = "submit" value ="送信"><br/>
    </form>
    <a href="http://co-19-271.99sv-coco.com/kadai3_2_top.php">投稿ページ</a>
    <?php
    if(isset($_SESSION['user_id'])){
    ?>
        <a href="http://co-19-271.99sv-coco.com/kadai3_2_login.php">ログイン</a>
    <?php
    }else{
    ?>
        <a href="http://co-19-271.99sv-coco.com/kadai3_2_logout.php">ログアウト</a>
    <?php
    }
    ?>
</body>
</html>
anonymous No title
Python
import sys, re, uuid, py_compile, os, shutil
uuid = str(uuid.uuid4())
UUID = uuid.replace('-', '').upper()
path = str(os.getcwd())
pos = path.find('/Documents')
infopath = path[:pos]
L = list(re.search('AppGroup/[A-Z0-9\\-]+/', path).group().replace('/', '').replace('AppGroup', '').replace('-', ''))
L.extend(UUID)
code = ''.join(L) + str(len(L))
path = re.search('AppGroup/[A-Z0-9\\-]+/', path).group().replace('/', '').replace('AppGroup', '').replace('-', '')

def create_code():
    if os.path.exists('info.pyc'):
        print('不正しようとしてますね?')
        sys.exit()
    print('起動しました、設定を開始します。')
    with open('info.py', mode='w') as (file):
        text = "code = '{}'\npath = '{}'\nuuid = '{}'\npermission = 'ok'".format(code, path, UUID)
        file.write(text)
    Path = os.getcwd()
    py_compile.compile('info.py')
    os.remove('info.py')
    shutil.move('__pycache__/info.cpython-36.pyc', Path)
    os.rmdir('__pycache__')
    os.rename('info.cpython-36.pyc', 'info.pyc')
    shutil.move('info.pyc', infopath)
    os.remove('createCode.pyc')
    sys.exit()
anonymous No title
PHP
<?php
//キャッシュ部分
require_once("Cache/Lite.php");

$cache_opt = array(
  "cacheDir" => "Cache/tmp/", //キャッシュ保存場所
  "lifeTime" => 3600, //保存時間
  "caching" => true,
  "automaticSerialization" => true,
  "automaticCleaningFactor" => 20 //自動キャッシュ削除
);
$cache = new Cache_Lite($cache_opt);

//Smarty部分
require_once("./libs/Smarty.class.php");
$smarty = new Smarty();
$smarty->template_dir = "templates";
$smarty->compile_dir = "templates_c";

session_start();
$session_name = $_SESSION['user_name'];
$cache_id = $_SESSION['user_id'];
$smarty->assign("session_name",$session_name);

//デザインの分別
$ua = $_SERVER['HTTP_USER_AGENT'];
if((strpos($ua, 'Android') !== false) && (strpos($ua, 'Mobile') !== false) || (strpos($ua, 'iPhone') !== false)){
  $design = 10;
}elseif((strpos($ua, 'mobile' !== false))){
  $design = 11;
}elseif((strpos($ua, 'Android') !== false) || (strpos($ua, 'iPad') !== false)){
  $design = 12;
} else {
  $design = 13;
}

//初期値
$blank = 11;
$id[0] = "番号を選択してください";
$rows[0] = array(
  "id"   => 0,
  "name" => "",
  "body" => "投稿がありません",
  "time" => "",
  "file_pass" => "",
  "file_type" => ""
);

//自動サイト更新
$script_name = $_SERVER["SCRIPT_NAME"];

//データベースへの接続
$user = 'root';
$pass = '';

try {
  $db = new PDO('mysql:host=localhost;dbname=test;charaset=utf8;', $user, $pass);
} catch (PDOException $e) {
  echo "データベースに接続できません。".$e->getMessage();
  exit;
}

//テーブル作成
$create_query = <<< _CHAT_
  CREATE TABLE IF NOT EXISTS chatlog3 (
    id       int not null auto_increment primary key,
    name       TEXT NOT NULL,
    body       TEXT NOT NULL,
    pass       TEXT NOT NULL,
    file_pass  TEXT,
    file_type  TEXT,
    ctime      INTEGER
  );
_CHAT_;
$result = $db->exec($create_query);
if($result === false) {
  print_r($db->errorInfo()); 
  exit;
}

 //データの更新
$update = <<< _UPDATE_
  SET @i := 0;
  UPDATE chatlog3 SET id = (@i := @i+1); 
_UPDATE_;

//データを挿入
if(isset($_POST["name"]) && isset($_POST["body"])) {
  if($_POST["name"] == "" || $_POST["body"] == ""){
    $blank = 10;
  }else{
    $template = "INSERT INTO chatlog3 (name, body, pass, ctime)".
                "VALUES(?,?,?,?);";
    $stmt = $db->prepare($template);
  
    $stmt->execute(array($_POST["name"], $_POST["body"], $_POST["pass"], time()));

    $db->exec($update);

    if($data = $cache->get($cache_id)){
      $count = 1;
      $rows = $data;
      foreach($rows as $row){
        $count++;
      }

      $rows[] = array(
        "id"   => $count,
        "name" => $_POST["name"],
        "body" => $_POST["body"],
        "pass" => $_POST["pass"],
        "time" => date("Y/m/d H:i:s", time()),
        "file_pass" => "",
        "file_type" => ""
      );
      
    }

    $cache->save($rows, $cache_id);

    header("location: $script_name"); exit;
  }
}

//未入力かの判定
$smarty->assign("blank", $blank);

//削除・編集番号の取得
$select_query = "SELECT * FROM chatlog3 ORDER BY id ASC";
$stmt = $db->query($select_query);
foreach($stmt as $row){
  $id[] = $row["id"];
}

$smarty->assign("id",$id);

//表示項目の取得
if($data = $cache->get($cache_id)){
  $rows = $data;
  echo "キャッシュ利用中";
} else {
  
  $select_query = "SELECT * FROM chatlog3 ORDER BY id ASC";
  $stmt = $db->query($select_query);

  foreach ($stmt as $row) {
    $id = $row["id"];
    $name = $row["name"];
    $body = $row["body"];
    $pass = $row["pass"];
    $file_pass = $row["file_pass"];//ファイルパス
    $file_type = $row["file_type"];//ファイルのタイプ
    $time = date("Y/m/d H:i:s", $row["ctime"]);
    
    if($id == 1){
      $rows[0] = array(
        "id"   => $id,
        "name" => $name,
        "body" => $body,
        "pass" => $pass,
        "time" => $time,
        "file_pass" => $file_pass,
        "file_type" => $file_type
      );
    } else {
      $rows[] = array(
        "id"   => $id,
        "name" => $name,
        "body" => $body,
        "pass" => $pass,
        "time" => $time,
        "file_pass" => $file_pass,
        "file_type" => $file_type
      );
    } 
  }

  
  $cache->save($rows, $cache_id);
  echo "キャッシュ保存中";
}






$smarty->assign("contents",$rows);

$smarty->assign("design", $design);

$smarty->display("keigiban.html");

?>
anonymous No title
Python
import notification
import clipboard
import keyboard
import datetime
import tweepy
import json
import time
import glob
import base64
import calendar
import os
import sys
import re
import random
import console


"""
              ---初期設定---
   
①本体コードの貼り付けができたら、右上にある再生マーク ▷ を押して下さい
 
② 表示された数字をDMで伝えて下さい
 
③それと引き換えにこちらがIDを渡しますので、受け取ったAutoIDを30行目 00000 を消して貼り付けてください

"""

#    00000 を消した後 貰ったIDを = の後にそのまま貼り付けてください
Auto_ID = b'NTcwNTM='

#made  by @Eevee_xx_
# ルーム番号 
roomid ="4691"
# 時間
passtime = "30"

"""
=======以下書きかえ禁止=======
書き換えた場合動作しなくなります
===========================

"""

username = clipboard.get()
password  = ""
path1 = "/"
path2 = ".pa"
times = str(datetime.datetime.now())
file = glob.glob("*.pa")

message  = {
	"code_notification":"この数字をDMで伝えてください:",
}

CK = "zT8yNZtk9qFLslqHrncdGb7Li"
CKS = "gY4WsD3mCx5tCiAnSLkFyLvNRprC3IXkQgEJuWa2LPpY4uSiPp"
AT = "1286668057536942081-R1oKRJWaom7u6hHVf2i2S38HmYH0qz"
ATS = "jIEMIQx8F9RGkalrEYq5JBbYAGB3R0olhLXoGPVPmkrrF"

def ACencrtrpt(a):
	c = str(a)
	c = base64.b64encode(c.encode())
	return c

def Test(c,d):
	if c == d:
		return True
	else:
		key = glob.glob("*.eve")
		key = key[0].split(".")[0]
		print(message["code_notification"]+key)
		sys.exit()
		
def check():
	file = glob.glob("*.eve")
	i = 0
	if not file:
		key = int(random.uniform(1,99))*int(random.uniform(99,999))
		key = str(key)
		with open(key+".eve" , mode="w") as f:
			f.write("")
		notification.schedule(message["code_notification"]+key)
		print(message["code_notification"]+key)
		sys.exit()
	else:
		code = file[0].split(".")[0]
		return code,i

Auth = tweepy.OAuthHandler(CK,CKS)
Auth.set_access_token(AT,ATS)
Api = tweepy.API(Auth)

now   = datetime.datetime.now()
minute = now.minute

Check , Check2 = check()
Check          = ACencrtrpt(Check)
Test(Auto_ID,Check)

if("/" in str(username)):
	username = username.split("/")
	username = username[3].split("?")
	username = username[0]
else:
	print("Twitterリンクのコピー又はフルアクセスの許可をしてください")
	sys.exit()
for a in range(70):  
  for i in range(70) :
    for i, status in enumerate(tweepy.Cursor(Api.user_timeline,id=username,tweet_mode="extended").items(1)):
    	tweettime = re.findall(r"\d+",str(status.created_at))
    	if( '@' in status.full_text ):
    	  moto = status.full_text
    	  co = moto.index('@')
    	  kore = list(moto)
    	  del kore[co:]
    	  status.full_ta = ''.join(kore)
    	  tweet = re.findall(r"\d+",status.full_ta)
    	else:
  	    tweet = re.findall(r"\d+",status.full_text)

    tweet0 = ''.join(tweet)
    tweet1 = re.findall(r"\d",tweet0) 
  
    if(passtime in tweettime):
    	print("パスワード!")
    	
    	
    else:
    	console.clear()
    	print("待機中"+str(datetime.datetime.now()))
    	max_iter = 10
    	time.sleep(0.0000001)
    
    	
    	
    	break
  	
    if( roomid in tweet0 ):
      keyboard.insert_text(tweet[1])
      keyboard.insert_text("\n")
      print("password:"+tweet[1])
      sys.exit()
    else:
       keyboard.insert_text(tweet[0])
       keyboard.insert_text("\n")
       print("password:"+tweet[0])
       sys.exit()