Skip to content

Instantly share code, notes, and snippets.

View Magnus167's full-sized avatar
🧘
thinking...

Palash Tyagi Magnus167

🧘
thinking...
View GitHub Profile
@Magnus167
Magnus167 / donut.py
Created June 21, 2021 02:49 — forked from Denbergvanthijs/donut.py
3D spinning donut in Python. Based on the pseudocode from: https://www.a1k0n.net/2011/07/20/donut-math.html
import numpy as np
screen_size = 40
theta_spacing = 0.07
phi_spacing = 0.02
illumination = np.fromiter(".,-~:;=!*#$@", dtype="<U1")
A = 1
B = 1
R1 = 1
@Magnus167
Magnus167 / asm.vbs
Created June 21, 2021 03:02 — forked from superllama/asm.vbs
An x86 assembler... in VBScript, for some reason. Includes two unfinished EXE projects.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Hit Ctrl+F and find the second instance of "here"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
exetxt = ""
loc = 0
eax="eax":ecx="ecx":edx="edx":ebx="ebx":esp="esp":ebp="ebp":esi="esi":edi="edi"
cs="cs":ds="ds"
al="al":cl="cl":dl="dl":bl="bl"
ah="ah":ch="ch":dh="dh":bh="bh"
ax="ax":cx="cx":dx="dx":bx="bx":sp="sp":bp="bp":si="si":di="di"
@Magnus167
Magnus167 / webdriver-packed-extension.py
Created July 8, 2021 17:48 — forked from cgoldberg/webdriver-packed-extension.py
Python - Selenium WebDriver - Installing a packed Chrome Extension
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
packed_extension_path = '/path/to/packed/extension.crx'
options = Options()
options.add_extension(packed_extension_path)
driver = webdriver.Chrome(options=options)
@Magnus167
Magnus167 / html2docx.bat
Created December 22, 2021 13:25 — forked from pagelab/html2docx.bat
Batch file to convert HTML files to Word docx with Pandoc
:: This batch file converts HTML files in a folder to docx.
:: It requires Pandoc, and a list of files to convert
:: named file-list, in which each file is on a separate line,
:: and contains no spaces in the filename.
::
:: Don't show these commands to the user
@ECHO off
:: Set the title of the window
TITLE Convert html to docx
:: This thing that's necessary.
@Magnus167
Magnus167 / remove_watermark.py
Created February 10, 2022 03:19
script to delete watermarks from PDFs. (only documents; won't work for removing watermarks from images inside)
from PyPDF2 import PdfFileReader, PdfFileWriter
import os
import glob
import sys
def removeWatermark(input_fname, output_fname):
with open(input_fname, "rb") as inputFile, open(output_fname, "wb") as outputFile:
reader = PdfFileReader(inputFile)
writer = PdfFileWriter()
@Magnus167
Magnus167 / loop_timer.py
Created February 21, 2022 05:11
timing loop addition methods in python
from random import SystemRandom as SR
def f1(arr):
s = 0
for i in range(len(arr)):
for j in range(len(arr[i])):
s += arr[i][j]
return s
def f2(arr):
@Magnus167
Magnus167 / gist:f3b3d441e22fb988e2cd902240f7833a
Created March 7, 2022 01:10 — forked from why-not/gist:4582705
Pandas recipe. I find pandas indexing counter intuitive, perhaps my intuitions were shaped by many years in the imperative world. I am collecting some recipes to do things quickly in pandas & to jog my memory.
"""making a dataframe"""
df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB'))
"""quick way to create an interesting data frame to try things out"""
df = pd.DataFrame(np.random.randn(5, 4), columns=['a', 'b', 'c', 'd'])
"""convert a dictionary into a DataFrame"""
"""make the keys into columns"""
df = pd.DataFrame(dic, index=[0])
@Magnus167
Magnus167 / paint.py
Created March 28, 2022 23:19 — forked from nikhilkumarsingh/paint.py
A simple paint application using tkinter in Python 3
from tkinter import *
from tkinter.colorchooser import askcolor
class Paint(object):
DEFAULT_PEN_SIZE = 5.0
DEFAULT_COLOR = 'black'
def __init__(self):
@Magnus167
Magnus167 / python_tools.md
Last active May 1, 2022 03:48
Python tools and data science stuff useful links
@Magnus167
Magnus167 / mandelbrot.ipynb
Created May 8, 2022 02:39
Python Notebook for generating images of the mandelbrot set
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.