๐
This file contains hidden or 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 pygame | |
| from pygame.locals import * | |
| from OpenGL.GL import * | |
| from OpenGL.GLU import * | |
| import math | |
| def draw_dotted_sphere(radius, lats, longs): | |
| for i in range(lats): | |
| lat0 = math.pi * (-0.5 + float(i) / lats) | |
| z0 = radius * math.sin(lat0) |
This file contains hidden or 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
| git config --global --unset credential.helper osxkeychain | |
| git config --system --unset credential.helper osxkeychain | |
| git config --global --unset credential.helper | |
| git config --system --unset credential.helper | |
| # disable gui prompt | |
| git config --global core.askPass "" | |
| git config --system core.askPass "" | |
| # set up cache |
This file contains hidden or 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 sum_series(n): | |
| total_sum = 0 | |
| for k in range(1, n + 1): | |
| total_sum += 1 / (2 ** k) | |
| return total_sum | |
| n = 1000 # Number of terms to approximate the sum | |
| result = sum_series(n) | |
| print("Approximate sum of the series:", result) |
This file contains hidden or 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 tkinter as tk | |
| def send_message(event=None): | |
| message = input_entry.get() | |
| if message.strip(): | |
| chat_history.configure(state=tk.NORMAL) | |
| chat_history.insert(tk.END, "You: " + message + "\n") | |
| chat_history.configure(state=tk.DISABLED) | |
| input_entry.delete(0, tk.END) |
This file contains hidden or 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 | |
| import importlib | |
| sys.exit = lambda *args, **kwargs: ... | |
| print(f"sys.exit overridden: {sys.exit}") | |
| importlib.reload(sys) | |
| print(f"sys.exit restored: {sys.exit}") | |
| try: | |
| print("test") | |
| sys.exit(0) | |
| except SystemExit as e: |
This file contains hidden or 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 | |
| from PyQt5.QtCore import Qt, QRect, QPoint | |
| from PyQt5.QtGui import QPainter, QBrush, QColor, QRegion | |
| from PyQt5.QtWidgets import QApplication, QWidget | |
| class SeeThroughHoleWindow(QWidget): | |
| def __init__(self): | |
| super().__init__() | |
| self.initUI() | |
| self.dragging = False |
This file contains hidden or 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
| from tree_sitter import Language, Parser, Tree, Node | |
| import tree_sitter_c | |
| from typing import Generator | |
| C_LANGUAGE = Language(tree_sitter_c.language(), "c") | |
| parser = Parser() | |
| parser.set_language(C_LANGUAGE) | |
| c_code = """ |
This file contains hidden or 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 | |
| import termios | |
| import tty | |
| def get_text_area_size(): | |
| # Save the terminal's original settings | |
| fd = sys.stdin.fileno() | |
| original_attributes = termios.tcgetattr(fd) | |
| try: |
This file contains hidden or 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 curses | |
| def get_terminal_size(): | |
| try: | |
| # Initialize curses | |
| stdscr = curses.initscr() | |
| # Turn off echoing of keys, and enter cbreak mode, | |
| # where no buffering is performed on keyboard input | |
| curses.noecho() |