Skip to content

Instantly share code, notes, and snippets.

View Snbig's full-sized avatar
📚
I may be slow to respond.

Hamed Salimian Snbig

📚
I may be slow to respond.
View GitHub Profile
@Snbig
Snbig / calculating the digits of π (Chudnovsky algorithm)
Created December 23, 2023 04:54
calculating the digits of π (Chudnovsky algorithm)
k,a,b,a1,b1=2,4,1,12,4
pi=''
digits=30000
while len(pi) < digits:
p,q,k=k*k,2*k+1,k+1
a,b,a1,b1=a1,b1,p*a+q*a1,p*b+q*b1
d,d1=a//b,a1//b1
while d == d1 and len(str(d)) < digits:
pi+=str(d)
a,a1=10*(a%b),10*(a1%b1)
@Snbig
Snbig / Anti-Copy.html
Created July 28, 2019 16:15
Prevent website contents from being copied
<html>
<!-- Anti-Copy by Snbig | See more: https://github.com/Snbig -->
<head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.4.1.min.js"></script>
<script>
$(document).bind('copy', function(event) {
event.preventDefault();
});
</script>
</head>
@Snbig
Snbig / ExportToExcel.py
Created June 28, 2019 11:26
Export InstaTrack results to Excel
import xlwt
collections = list()
def toExcel(file):
with open(file, 'r') as file:
collections = file.readlines()
wb = xlwt.Workbook()