This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def no_common_element_list(a,b): | |
return set(a) - set(b) == set(a) and set(b) - set(a) == set(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Works on Manim Community Edition v0.15.0 | |
from manim import * | |
from manim.opengl import * | |
import textwrap | |
class InlineFullScreenQuad(Scene): | |
def construct(self): | |
surface = FullScreenQuad( | |
self.renderer.context, | |
textwrap.indent(""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
normal_headers = [ | |
"absolute.h", | |
"c-ctype.h", | |
"c-dir.h", | |
"c-errno.h", | |
"c-fopen.h", | |
"c-limits.h", | |
"c-memstr.h", | |
"c-minmax.h", |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A program to check if the compiler passed | |
# is a Mingw-w64 based compiler. | |
import os | |
import subprocess | |
import argparse | |
import sys | |
def is_mingw(CC): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
INSTALLER_URL="http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz" | |
tmpdir=$(mktemp -d) | |
mkdir -pv $tmpdir | |
echo "Cding into temp directory $tmpdir" | |
cd $tmpdir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def binary_search(arr, low, high, number): | |
if high >= low: | |
mid = (high + low) // 2 | |
if arr[mid] == number: | |
return mid | |
elif arr[mid] > number: | |
return binary_search(arr, low, mid - 1, number) | |
else: | |
return binary_search(arr, mid + 1, high, number) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() { | |
int row, col; | |
printf("enter row and col:"); | |
scanf("%d %d", &row, &col); | |
int **mat; | |
mat = calloc(row, sizeof(int *)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A program to make an image as a square maintaining aspect ratio and fill white spaces for extra space. | |
# I used this for instagram posts | |
from PIL import Image | |
import os | |
from pillow_heif import register_heif_opener | |
register_heif_opener() | |
# find largest width and length |