Skip to content

Instantly share code, notes, and snippets.

View tomlin7's full-sized avatar
🌐
uni

billy tomlin7

🌐
uni
View GitHub Profile
import ctypes as ct
def dark_title_bar(window):
"""
MORE INFO:
https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute
"""
window.update()
DWMWA_USE_IMMERSIVE_DARK_MODE = 20
set_window_attribute = ct.windll.dwmapi.DwmSetWindowAttribute
get_parent = ct.windll.user32.GetParent
@kkrypt0nn
kkrypt0nn / ansi-colors-discord.md
Last active June 27, 2024 10:49
A guide to ANSI on Discord

A guide to ANSI on Discord

Discord is now slowly rolling out the ability to send colored messages within code blocks. It uses the ANSI color codes, so if you've tried to print colored text in your terminal or console with Python or other languages then it will be easy for you.

Quick Explanation

To be able to send a colored text, you need to use the ansi language for your code block and provide a prefix of this format before writing your text:

\u001b[{format};{color}m

\u001b is the unicode escape for ESCAPE/ESC, meant to be used in the source of your bot (see ). If you wish to send colored text without using your bot you need to copy the character from the website.

@oleksis
oleksis / Compile_wxPython_4.1.2a1_Python3.10_Windows.md
Last active January 7, 2023 23:09
Compile wxPython 4.1.2a1 using Microsoft C++ Build Tools 2019

Use case:

  • Windows 11 Dev Channel
  • GnuWin32: Make winget install -e --id GnuWin32.Make
  • Windows Subsystem for Linux 2
➜ wsl --version
WSL version: 0.50.2.0
Kernel version: 5.10.74.3
WSLg version: 1.0.29
Windows version: 10.0.22523.1000
@FleshMobProductions
FleshMobProductions / ReplaceSceneObjectsWithPrefabWindow.cs
Created July 14, 2021 15:41
Replace Scene Objects With Prefab (Unity Editor Tool) - Define filter criteria for objects to select, such as what attached component types they need to have or which tag they need to have, then replace them with a prefab instance of choice
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.SceneManagement;
using System.Linq;
namespace FMPUtils.Editor
{
public class ReplaceSceneObjectsWithPrefabWindow : EditorWindow
{
@idbrii
idbrii / ShakeIn2D.cs
Last active February 2, 2024 15:13
Unity camera shake 2d
// Released under CC0 and Unlicense
// Demo: https://imgur.com/a/9h3c6W5
// Screenshake should move the camera around smoothly but unpredictably. It
// shouldn't jitter the camera around in a way that makes it hard to follow
// what's on screen. That's why you should use continuous oscillating functions
// to produce your shake instead of random values. I also think it's useful to
// make a directional shake to help connect the shaking to the thing that
// caused it.
@manishtiwari25
manishtiwari25 / country_state.json
Last active July 1, 2024 00:07
List Of Countries With States And Other Useful Information, Updated On 07/01/2024 00:07:57
[
{
"name": "Andorra",
"countryCode": "AD",
"countryCodeAlpha3": "AND",
"phone": "376",
"currency": "EUR",
"flag": "",
"symbol": "\u20AC",
"stateProvinces": [
@Denbergvanthijs
Denbergvanthijs / donut.py
Last active June 5, 2024 11:22
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
@dannguyen
dannguyen / fetch_ghstars.md
Last active April 10, 2024 19:25
fetch_ghstars.py: quick CLI script to fetch from Github API all of a user's starred repos and save it as raw JSON and wrangled CSV

fetch_ghstars.py: quick CLI script to fetch and collate from Github API all of a user's starred repos

  • Requires Python 3.6+
  • Creates a subdir 'ghstars-USERNAME' at the current working directory
  • the raw JSON of each page request is saved as: 01.json, 02.json 0n.json
  • A flattened, filtered CSV is also created: wrangled.csv

Example usage:

@pardhav-m
pardhav-m / 1_main.py
Last active April 11, 2022 10:37
Blog: Interactive Voronoi
# https://pardhav-m.blogspot.com/2020/07/interactive-voronoi.html
# https://trinket.io/embed/python/17e4c5d950
# Interactive Voronoi
# Voronoi Points
import turtle
from Voronoi import Voronoi
# seeds
g_seeds = []
@algomaster99
algomaster99 / doomsday_fuel.py
Created April 24, 2020 11:34
Solution to Doomsday Fuel foobar challenge
from fractions import Fraction
# Replace trials by probabilties of occurrences
def replace_probability(m):
for row in range(len(m)):
total = 0
for item in range(len(m[row])):
total += m[row][item]
if total != 0:
for item in range(len(m[row])):