Skip to content

Instantly share code, notes, and snippets.

View naveen521kk's full-sized avatar
💭
Focusing!

Naveen M K naveen521kk

💭
Focusing!
View GitHub Profile
@naveen521kk
naveen521kk / palindrome.py
Created October 1, 2019 14:08
To check palindrome loops.
#To check whether a string is a palindrome or not.
s=input('Enter a word')
l=len(s)
mid=l//2
rev=-1
for a in range(l):
if s[a]==s[rev]:
rev-=1
else:
print("not a palindrome")
@naveen521kk
naveen521kk / install.py
Last active September 28, 2020 11:46
Install PyCairo For Windows
import platform
import os
import sys
import urllib.request
if 'Windows' in platform.system():
# In case the python version is 3.6 and the system is 32-bit, try pycairo‑1.19.1‑cp37‑cp37m‑win32.whl version of cairo
if sys.version[:3]=='3.6' and platform.machine()=='x86':
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/w3jqiv8s/pycairo-1.19.1-cp36-cp36m-win32.whl", "pycairo-1.19.1-cp36-cp36m-win32.whl")
os.system("pip install pycairo-1.19.1-cp36-cp36m-win32.whl")
@naveen521kk
naveen521kk / text_mobject.py
Created December 4, 2020 08:54
This is a small extension for Manim which will allow use of ttf files for rendering fonts in Manim using text2svg library.
# By Naveen M K
from manim import *
from text2svg import TextInfo, register_font, Style, Weight,CharSettings,text2svg
import os
import hashlib
import re
TEXT_MOB_SCALE_FACTOR = 0.05
class Text2(SVGMobject):
def __init__(
self,
from manim import *
class Emoji(Scene):
def construct(self):
a=Text('❌️ 😢 🔚 😀 ✨✨✨',font="sans-serif",color=RED).scale(2)
self.play(Write(a))
self.wait()
from manim import *
import numpy as np
class PIDay(Scene):
def construct(self):
self.camera.background_color = "#ece6e2"
pi=Tex("$\pi$")
pi.scale(6.)
pi.set_color(BLUE)
pi1 = pi.copy()
pi1.set_color(RED)
@naveen521kk
naveen521kk / msys2-here-uninstall.reg
Created March 29, 2021 12:17
Registry to get MSYS2 here shell explorer menu with icons
Windows Registry Editor Version 5.00
[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\MSYS here]
[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\MINGW64 here]
[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\MINGW32 here]
@naveen521kk
naveen521kk / manim-latex-smoke.py
Created April 2, 2021 11:20
A small smoke tests to test the chocolatey package
from manim import *
class SmokeTests(Scene):
def wait_and_clean(self):
self.wait(1)
self.clear()
def construct(self):
tex_test = [
r"\LaTeX",
import re
import typing
from pathlib import Path
import requests
from textwrap import dedent
import tempfile
import tarfile
import logging
logger = logging.getLogger("downloader: ")
@naveen521kk
naveen521kk / isprime.py
Created April 29, 2021 06:12
Check whether a number is prime or not
import math
def is_prime(n):
if n < 2:
return False
if n == 2:
return True
if n % 2 == 0:
return False
sqrt_n = int(math.floor(math.sqrt(n)))
@naveen521kk
naveen521kk / no_common_element_list.py
Last active April 30, 2021 05:11
Check for common elements in a list
def no_common_element_list(a,b):
return set(a) - set(b) == set(a) and set(b) - set(a) == set(b)