Skip to content

Instantly share code, notes, and snippets.

View ashkantaravati's full-sized avatar

Ashkan Taravati ashkantaravati

View GitHub Profile
@ashkantaravati
ashkantaravati / link-aggregator.js
Last active November 11, 2020 16:34
I wanted to download like 250 movie episodes so I wrote this script that I enter in F12 console and it alerts all links together in a comma-separated way so I can copy easily to uGet.
'permutation program'
def permute(data, size, picked):
'recursive function'
if not size:
res = ''.join(picked)
print(res)
else:
# print(data)
for element in data:
@ashkantaravati
ashkantaravati / physics1_newton2.py
Created December 7, 2018 17:15
python scripts I used for easing my calculations while writing lab report about Newton's 2nd law.
import pprint
def calc_tuple(x, t):
x_twice = round(2 * x,1)
t_times2 = round(t**2,2)
a = round(x_twice/t_times2, 2)
return (x,x_twice,t,t_times2,a)
def calc_table(tuple_list):
count = len(tuple_list)
@ashkantaravati
ashkantaravati / physics1_newton1.py
Created December 7, 2018 16:57
python scripts I used for easing my calculations while writing lab report about Newton's 1st law.
cases = [
(0.4,0.49),
(0.5,0.60),
(0.6,0.73),
(0.7,0.85)
]
velocities = [(distance/duration) for (distance, duration) in cases]
rounded_velocities = [round(v,3) for v in velocities]
average_velocity = sum(rounded_velocities) / float(len(rounded_velocities))
rounded_average_velocity = round(average_velocity, 3)
@ashkantaravati
ashkantaravati / UniversityProfRandScoreGen.js
Last active June 11, 2019 05:50
I was too lazy and tired to answer all the professor survey questions so I wrote this!
var matches = [].slice.call(document.querySelectorAll('[id^=DropDownList]'));//Gets all dropdown selectors in an array
for (var i=0;i<matches.length;i++){//iterate through dropdownlists
//** random number generator part
var min = Math.ceil(2);
var max = Math.floor(6);
var randscore=Math.floor(Math.random() * (max - min)) + min;
//** random number generator part ends
matches[i].selectedIndex=randscore.toString();// set scores
}//we're done