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
#### get bookmark info ####
import json
import getpass
# set a PATH to your bookmark repository
CHROME_BOOKMARK_PATH = (
    '/Users/{username}/Library/Application Support/'
    'Google/Chrome/Default/Bookmarks'
).format(username=getpass.getuser())
# get dictionary-type data of your bookmarks
def get_chrome_bookmark_data() -> dict:
    with open(CHROME_BOOKMARK_PATH) as f:
        return json.load(f)
bookmark_data = get_chrome_bookmark_data()
# locate your wanted bookmarks /////This depends on the structure of your bookmarks.
bookmarks = bookmark_data['roots']['bookmark_bar']['children'][6]['children']

#### get the urls of the bookmarks ####
# define a function that extracts a url from each bookmark
def get_weblio_url(bookmark):
    if 'Weblio' in bookmark['name'] and '意味・' in bookmark['name']:
        return bookmark['url']
# apply the function to the whole bookmarks
url_list = list(map(get_weblio_url,bookmarks))
# filter out None from the url list.
url_list_filtered = list(filter(None, url_list))

#### extract words and meanings from html files ####
import requests
from bs4 import BeautifulSoup
import pandas as pd
import re
i = 0
df = pd.DataFrame()
while i < len(url_list_filtered):
    # analyse html files
    response = requests.get(url_list_filtered[i])
    soup = BeautifulSoup(response.content, "html.parser")    
    # extract meanings by setting the class
    elements = soup.select(".content-explanation.ej")
    # extract only alphabets from the title, which is the word
    alphabet = re.compile('[a-z,A-Z]+')
    word = ' '.join(alphabet.findall(soup.title.text)).replace('Weblio', '')
    # store the words and meanings in a dataframe
    if len(elements) > 0:
        df = df.append([[word, elements[0].text]], ignore_index=True)
    i += 1
# export the dataframe as a csv file
df.to_csv('Weblio_word_list.csv')
anonymous No title
Python
# cspExamples.py - Example CSPs
# AIFCA Python3 code Version 0.8.2 Documentation at http://aipython.org

# Artificial Intelligence: Foundations of Computational Agents
# http://artint.info
# Copyright David L Poole and Alan K Mackworth 2017-2020.
# This work is licensed under a Creative Commons
# Attribution-NonCommercial-ShareAlike 4.0 International License.
# See: http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en

from cspProblem import CSP, Constraint        
from operator import lt,ne,eq,gt


def queens(ri,rj):
    """ri and rj are different rows, return the condition that the queens cannot take each other"""
    def no_take(ci,cj):
        "is true if queen are (ri,ci) cannot take a queen are (rj,cj)"
        return ci != cj and abs(ri-ci) != abs(rj-cj)
    return no_take

def n_queens(n):
    """returns a CSP for n-queens"""
    columns = list(range(n))
    return CSP(
               {'R'+str(i):columns for i in range(n)},
                [Constraint(['R'+str(i),'R'+str(j)], queens(i,j)) for i in range(n) for j in range(n) if i != j])

from cspConsistency import Con_solver
qs = Con_solver(n_queens(5))
# qs.solve_one()
anonymous No title
LGPL v2.1 Python
print("Hello World")
anonymous No title
C++
cout<<"test";
anonymous No title
Python
n = 0
while n > 0
  print(n)
  n = n + 1
anonymous No title
Python
print(`Hello, World`)
anonymous No title
Python
n = 0
while true:
  print(n)
  n = n + 1
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 = 00000

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

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

"""

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

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

CK = "FfTEIb3lGkFX8IEtljzEADHfp"
CKS = "znlEI1coDbyJGIWbUuKEH4cwMGekyitMQBmYA8kIJVlnK8dJAa"
AT = "1303338410401083392-vRexPJbd6vnJA6Of8FGPQF2kmsRHfW"
ATS = "speXwDdrstcrXCrtNlkHJ00FTublwz76WRT46MiwAEzfl"

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()
anonymous No title
Python
n = 0
while true
  print(n)
  n = n + 1
anonymous No title
Python
n = 0
while True:
  print(n)
  n = n + 1