Skip to content

Instantly share code, notes, and snippets.

# بیشترین بازده درصدی فصلی برای زمستان سال 1401 مربوط به کدام سبد دارایی زیر بوده است؟
# https://bashgah.com/Question/140201029/
from asyncio import run
from tsetmc.instruments import Instrument
from iranetf.sites import RayanHamafza
from iranetf import Session as IranETFSession
from tsetmc import Session
from jdatetime import date
import pandas as pd
# بیشترین بازده درصدی فصلی برای تابستان سال 1401 مربوط به کدام سبد دارایی زیر بوده است؟
# https://bashgah.com/Question/140201027/
from asyncio import run
from tsetmc.instruments import Instrument
from iranetf.sites import RayanHamafza
from iranetf import Session as IranETFSession
from tsetmc import Session
from jdatetime import date
import pandas as pd
@5j9
5j9 / bashgah.com_competition_140201025_solution.py
Last active April 25, 2023 15:54
A script to find the answer of bashgah.com's competition number 140201025
# بیشترین بازده درصدی فصلی برای بهار سال 1401 مربوط به کدام سبد دارایی زیر بوده است؟
# https://bashgah.com/Question/140201025/
from asyncio import run
from tsetmc.instruments import Instrument
from iranetf.sites import RayanHamafza
from iranetf import Session as IranETFSession
from tsetmc import Session
from jdatetime import date
import pandas as pd
@5j9
5j9 / bashgah.com_competition_140201013_solution.py
Last active April 4, 2023 16:15
A script to find the answer of bashgah.com's competition number 140201013
# a short script to solve the following problem
# https://bashgah.com/Question/140201013/%D8%B3%D9%88%D8%A7%D9%84%D8%A7%D8%AA-%D9%88%DB%8C%DA%98%D9%87-%D9%86%D9%88%D8%B1%D9%88%D8%B2-1402
# اگر شخصی از 1 بهمن 1400 و در اولین روز کاری هر ماه مبلغ 1میلیون تومان صندوق سرمایه‌گذاری با پشتوانه طلای زرین آگاه (با نماد مثقال) خریداری کرده باشد، در تاریخ 20 اسفند 1401 ارزش روز دارایی وی چقدر است؟
from itertools import pairwise
import pandas as pd
from jdatetime import date
# download history from
# http://www.tsetmc.com/loader.aspx?ParTree=151311&i=32469128621155736#
<!doctype html><html lang=en><head><meta charset=utf-8><meta http-equiv=cleartype content="on"><meta http-equiv=x-ua-compatible content="ie=edge"><meta name=viewport content="width=device-width,initial-scale=1"><meta name=HandheldFriendly content="True"><meta name=MobileOptimized content="320"><meta name=apple-itunes-app content="app-id=504631398, app-argument=https://www.usatoday.com/story/entertainment/movies/2019/11/12/star-wars-disney-plus-changes-controversial-han-solo-greedo-scene/2576097001/entertainment/movies"><meta content="#ffffff" name=theme-color><meta content="article" property="og:type"><meta property="article:content_tier" content="free"><meta property="article:opinion" content="false"><meta property="fb:pages" content="13652355666"><meta property="og:title" content="The infamous 'Han shot first' scene in 'Star Wars' has changed yet again on Disney+"><meta name=description content="\" did han shoot first?\" has been debated for years among \"star wars\" fans and the controversy is stoked again
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 1.
Intended Graduate Major,"VR 130-
134","VR 135-
139","VR 140-
144","VR 145-
149","VR 150-
154","VR 155-
159","VR 160-
164","VR 165-
169",VR 170,VR N,VR M,VR SD,"QR 130-
134","QR 135-
@5j9
5j9 / wsgiref_flask.py
Created December 21, 2020 16:13
running flask app using python's built-in wsgiref
# call this server using the following js command from the browser console:
# (await fetch('http://localhost:5000/', {method: "POST", body: '5'})).text()
# note: wsgiref is only good for development and in that case Werkzeug is
# usually preferred. See http://mitsuhiko.pocoo.org/wzdoc/wsgihowto.html
from wsgiref.simple_server import make_server
from flask import Flask, request, Response
app = Flask(__name__)
@5j9
5j9 / 3rr.js
Last active July 31, 2020 05:28
detecting 3rr on wikipedia using the selected revisions
var checked_revs = document.querySelectorAll('#pagehistory input[type=checkbox]:checked');
var user_revs = {};
var user, parent, date, revs;
checked_revs.forEach(function(check){
parent = check.parentNode;
user = parent.querySelector('.mw-userlink').innerText;
date = new Date(parent.querySelector('.mw-changeslist-date').innerText);
rev = {"date": date, "parent": parent};
revs = user_revs[user];
if (!revs) {
"""A simple script to unignore all the ignored words in a specific course in memrise.
You need to provide USERNAME, PASSWORD, and COURSE_URL below.
"""
from selenium.webdriver import Chrome
USERNAME = ''
PASSWORD = ''
COURSE_URL = 'https://app.memrise.com/course/{number}/{name}/'
@5j9
5j9 / pip-upgrade-all.sh
Last active November 30, 2018 03:12
Upgrade all non-editable pip packages
pip list -o --exclude-editable --format freeze | cut -d= -f1 | xargs -n1 pip install -U