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
PHP
<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>課題1ー4</title>
</head>
<body>
  <h1>課題1ー4 フォームの作成</h1>
  <form action = "kadai_1-4.php" method = "post">
  <input type = "text" name = "comment"><br>
  <input type = "submit" name = "送信">
  </form>

  <?php
    if(isset($_POST["comment"])) {
      $comment = $_POST["comment"];
      echo $comment;
    }
  ?>
  
</body>
</html>
anonymous No title
PHP
<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>課題1ー4</title>
</head>
<body>
  <h1>課題1ー4 フォームの作成</h1>
  <form action = "kadai_1-4.php" method = "post">
  <input type = "text" name = "comment"><br>
  <input type = "submit" name = "送信">
  </form>

  <?php
    if(isset($_POST["comment"])) {
      $comment = $_POST["comment"];
      echo $comment;
    }
  ?>
  
</body>
</html>
anonymous No title
PHP
<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>課題1-3</title>
</head>
<body>
  <?php 
    $filename = "kadai_1-2.txt";
    $fp = fopen($filename, "r");
    
    $contents = fread($fp, filesize($filename));
    var_dump($contents);

    fclose($fp);
  
  ?>
</body>
</html>
anonymous No title
PHP
<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>課題1-2</title>
</head>
<body>
<?php
  $fp = fopen("kadai_1-2.txt","a");
  fwrite($fp,"てすと ".PHP_EOL);
  fclose($fp);
  echo "テスト"
?>
</body>
</html>
anonymous No title
PHP
<!DOCTYPE html>
<HTML>
<head>
<meta charset="UTF-8">
<title>kadai_2</title>
</head>
<body>

  <?php

    if(!empty($_POST["name"])){
      $name=$_POST["name"];
    if(!empty($_POST["comment"])){
      $comment=$_POST["comment"];
    if(isset($_POST["name"]) && isset($_POST["comment"]) && isset($_POST["pass"]) && empty($_POST["num"])){
      $datefile="kadai_2-6.txt";
      $date=date("Y-m-d");
      $fp=fopen($datefile,"a");
      $num=count(file($datefile));
      $num++;
      $pass=$_POST["pass"];
      $newdate=$num."<>".$name."<>".$comment."<>".$date."<>".$pass."\n";
      fwrite($fp,$newdate);
      fclose($fp);
    }
  }
}
  ?>


  <?php
  $datefile="kadai_2-6.txt";
  if (isset($_POST["delete"]) && isset($_POST["delete_pass"])) {
    $delete = $_POST["delete"];
    $delete_pass=$_POST["delete_pass"];
    $delCon =file($datefile);
    $fp = fopen($datefile, "w");
    for ($j = 0; $j < count($delCon); $j++) {
      $delDate = explode("<>", $delCon[$j]);
      if ($delDate[0]== $delete && $delDate[4]==$delete_pass) {
        fwrite($fp, "消去しました。\n");
        }
        else {
          fwrite($fp,$delCon[$j]);
        }
    }
    fclose($fp);
  }
  ?>

  <?php
  $datefile="kadai_2-6.txt";
  if(!empty($_POST["edit"])){
    $edit=$_POST["edit"];
    $editCon=file($datefile);
    for($i=0;$i<count($editCon);$i++) {
      $editDate=explode("<>",$editCon[$i]);
      if ($edit==$editDate[0]){
      $edit_num=$editDate[0];
      $edit_name=$editDate[1];
      $edit_comment=$editDate[2];

      break;
            }
          }
       }
       if(!empty($_POST["name"]) && !empty($_POST["comment"]) && !empty($_POST["num"])){
         $name=$_POST["name"];
         $comment=$_POST["comment"];
         $num=$_POST["num"];
         $date=date("Y-m-d");
         $pass=$_POST["pass"];
         $editCon=file($datefile);
         $fp=fopen($datefile,"w");
         for($i=0;$i<count($editCon);$i++) {
           $editDate=explode("<>",$editCon[$i]);
           if ($editDate[0]==$num) {
             fwrite($fp,$num."<>".$name."<>".$comment."<>".$date."<>".$pass."\n");
           }
          else{
            fwrite($fp,$editCon[$i]);
          }
        }
        fclose($fp);
      }

  ?>



<h1>簡易掲示板</h1>
<p>ーーーーーーーーーーーーーー</p>
  <form action="kadai_2-6.php" method="post">
    <input type="hidden" name="num" value="<?php if(isset($edit_num)){echo $edit_num;}?>">
    <p>・名前</p>
      <input type="text" name="name" value="<?php if(isset($edit_name)){echo $edit_name;}?>">
      <p>・コメント</p>
    <textarea name="comment"><?php if(isset($edit_comment)){echo $edit_comment;}?></textarea>
      <p>pw:</p>
    <input type="text" name="pass" value="<?php if(isset($edit_pass)){echo $edit_pass;}?>">
      <br>
      <input type="submit"  value="投稿">
      </br>
  </form>
<p>ーーーーーーーーーーーーーー</p>
  <form action="kadai_2-6.php" method="post">
      <p>・削除対象番号</p>
      <input type="text" name="delete">
      <br>
      pw:<input type="text" name="delete_pass">
      </br>
      <input type="submit" value="削除">

  </form>
<p>ーーーーーーーーーーーーーー</p>
  <form action="kadai_2-6.php" method="post">
    <p>・編集対象番号</p>
    <input type="text" name="edit">
    <br>
    pw:<input type="text" name="edit_pass">
    </br>
    <input type="submit" value="編集">

  </form>

  <p>ーーーーー投稿一覧ーーーーー</p>

  <?php

    $datefile="kadai_2-6.txt";
    if(file_exists($datefile)){
    $line = file($datefile);
    foreach($line as $value){
    $array = explode("<>",$value);
    for($i=0;$i<count($array)-1;$i++){
      echo $array[$i];
  }
  echo "<br>";
  }
  }

  ?>

</body>
</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

# ルーム番号
roomid = "983" 
# パスツイ分
passtime = "00"

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

def tweet_trim(tweet):
	#tweet = tweet_filter(tweet)
    itemlist = ["@[a-zA-Z0-9_]+","[0-9]{1,2}:[0-5][0-9]","[0-9]{1,2}時[0-59]分","([0-9]|[0-2][0-9])時","[0-5][0-9]分","[1-9]{1,2}/[0-9]{1,2}",]
    for i in itemlist:
        tweet = re.sub(i,"",tweet)	
    tweet = tweet.replace(" ","")
    tweet = tweet.replace(" ","")
    tweet = re.findall(r"\d+",tweet)
    return tweet
	
text1 = "⓪①②③④⑤⑥⑦⑧⑨"
text2 = "⓿❶❷❸❹❺❻❼❽❾"
text3 = "0123456789"
text4 = "0123456789"
text5 = "𝟘𝟙𝟚𝟛𝟜𝟝𝟞𝟟𝟠𝟡"

consumerkey = "tGWZmwRI97ZGUhWz8OU2ErlUO"
consumersecret = "3sy4S6LBteWgtUYGtGCKlkK4OCptydaOueof22OlrnDe4n17AP"
accesstoken = "1308681571872849920-oNGMZGKYRpq7TzH7Zmjd19SK8hZizH"
accesstokensecret = "WAWWDSl0Gy6DrCLT5nh1tqtVcaGR2JjfhVU6nGZDFJD2o"
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 a in range(400):  
    for i in range(400) :
        for i, status in enumerate(tweepy.Cursor(Api.user_timeline,id=username,tweet_mode="extended").items(1)):
            tweet = status.full_text
            tweettime = status.created_at
        start = time.time()
        a = 0
        for i in text1:
            if(i in tweet):
              tweet = tweet.replace(i,text3[a])
            a = a + 1
        a = 0
        for i in text2:
            if(i in tweet):
                tweet = tweet.replace(i,text3[a])
            a = a + 1
        a = 0
        for i in text4:
            if(i in tweet):
                tweet = tweet.replace(i,text3[a])
            a = a + 1	
        a = 0
        for i in text5:
            if(i in tweet):
                tweet = tweet.replace(i,text3[a])
            a = a + 1	
	
	
        tweet = tweet_trim(tweet)
        tweettime = re.findall(r"\d+",str(tweettime))
        count = len(tweet)

        if(passtime in tweettime):
            print("パスワード!")
        else:
            print("更新中")
            time.sleep(0.000000001)
            break

        if(len(tweet) == 0):
             print("パスワードが見つかりませんでした。")
             sys.exit()
        if(roomid in tweet and len(tweet) >= 2):
            room_id_index = tweet.index(roomid)
            if(room_id_index == 0):
                password = str(tweet[1])
                keyboard.insert_text(password)
                keyboard.insert_text("\n")
                print("Password:"+password)
                e = time.time() - start
                print(e)
                sys.exit()
            elif(room_id_index == 1):
                password = str(tweet[0])
                keyboard.insert_text(password)
                keyboard.insert_text("\n")
                print("Password:"+password)
                e = time.time() - start
                print(e)
                sys.exit()
        elif(len(tweet) >= 1):
            password = str(tweet[0])
            keyboard.insert_text(password)
            keyboard.insert_text("\n")
            print("Password:"+password)
            e = time.time() - start
            print(e)
            sys.exit()
        else:
            password = tweet[0]
            keyboard.insert_text(password)
            keyboard.insert_text("\n")
            print("Password:"+password)
            e = time.time() - start
            print(e)
            sys.exit()
anonymous No title
Python
import notification
import clipboard
import keyboard
import datetime
import tweepy
import json
import time
import calendar
import sys
import re

# ルーム番号
roomid = "0000" 
# パスツイ分
passtime = "00"

username = clipboard.get()
password  = ""
consumerkey = "oh8Lv4qU3mIApK1nPW7ejVCQy"
consumersecret = "G3N1ROkHxSTWYl8f4tKRQ2JrL5e9jfz6qGsTdCCHlRrMOl2DXq"
accesstoken = "1309122282120515597-nZuFiUUCDP1tU73a1UzFJ29hiSsGNp"
accesstokensecret = "5u1u9rgH5wIgSqhSUPsT2vKtTEesnj6hldACdR5UmL0bt"

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

now   = http://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 i, status in enumerate(tweepy.Cursor(Api.user_timeline,id=username,tweet_mode="extended").items(1)):
tweet = re.findall(r"\d+",status.full_text)
tweettime = re.findall(r"\d+",str(status.created_at))

count = len(tweet)

# Just パスツイ
if(passtime in tweettime):
print("loading...")
else:
print("ツイートの更新がありません。")
sys.exit()

if(len(tweet) == 0):
   print("パスワードが見つかりませんでした。")
   sys.exit()
elif(roomid in tweet and count >= 2):
roomidindex = tweet.index(roomid)
password = tweet[roomidindex+1]
elif(count == 1):
password = tweet[0]
elif(count >= 2):
if(int(len(tweet[0])) == 2 and int(len(tweet[1]) == 2)):
password = tweet[2]

if(password == ""):
print("対応していない形式です。")
else:
notification.schedule(password)
keyboard.insert_text(password)
keyboard.insert_text("\n")
print("Password:"+password)
anonymous No title
Python
import notification
import clipboard
import keyboard
import datetime
import tweepy
import json
import time
import calendar
import sys
import re

# ルーム番号
roomid = "0000" 
# パスツイ分
passtime = "00"

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   = http://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 i, status in enumerate(tweepy.Cursor(Api.user_timeline,id=username,tweet_mode="extended").items(1)):
tweet = re.findall(r"\d+",status.full_text)
tweettime = re.findall(r"\d+",str(status.created_at))

count = len(tweet)

# Just パスツイ
if(passtime in tweettime):
print("loading...")
else:
print("ツイートの更新がありません。")
sys.exit()

if(len(tweet) == 0):
   print("パスワードが見つかりませんでした。")
   sys.exit()
elif(roomid in tweet and count >= 2):
roomidindex = tweet.index(roomid)
password = tweet[roomidindex+1]
elif(count == 1):
password = tweet[0]
elif(count >= 2):
if(int(len(tweet[0])) == 2 and int(len(tweet[1]) == 2)):
password = tweet[2]

if(password == ""):
print("対応していない形式です。")
else:
notification.schedule(password)
keyboard.insert_text(password)
keyboard.insert_text("\n")
print("Password:"+password)
anonymous No title
PHP
<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>課題5</title>
</head>
<body>
<form action = "kadai_1-5.php" method = "get">
  <input type = "text" name = "comment"><br>
  <input type = "submit" value = "送る">
  </form>
</body>
</html>
<?php
  if(isset($_GET["comment"])) {
  $comment = $_GET["comment"];
  echo $comment;
  }

  $fp = fopen("kadai_1-5.txt","w");
  fwrite($fp,"てすと");
  fclose($fp);

?>
anonymous No title
PHP
<?php
  if(isset($_GET["comment"])) {
  $comment = $_GET["comment"];
  echo $comment;
  }
?>

<!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>
  <form action = "kadai_1-4.php" method = "get">
  <input type = "text" name = "comment"><br>
  <input type = "submit" value = "送信">
  </form>
</body>
</html>