Skip to content

Instantly share code, notes, and snippets.

View LucasCoderT's full-sized avatar
🏡
Working From Home

Lucas LucasCoderT

🏡
Working From Home
  • Edmonton, Alberta
  • 00:24 (UTC -06:00)
View GitHub Profile
@fatbobman
fatbobman / noteExtension.swift
Created March 16, 2024 13:40
ModelExtensionDemo
import Foundation
import SwiftData
extension Note {
/// 根据给定的筛选条件生成相应的谓词,用于筛选笔记。
public static func predicateFor(_ filter: NotePredicate) -> Predicate<Note>? {
var result: Predicate<Note>?
switch filter {
case let .filterRootNoteByName(name):
result = #Predicate<Note> { $0.name == name && $0.parent == nil }
@lancethomps
lancethomps / close_notifications_applescript.js
Last active October 16, 2024 09:42
AppleScript to close all notifications on macOS Big Sur, Monterey, and Ventura
function run(input, parameters) {
const appNames = [];
const skipAppNames = [];
const verbose = true;
const scriptName = "close_notifications_applescript";
const CLEAR_ALL_ACTION = "Clear All";
const CLEAR_ALL_ACTION_TOP = "Clear";
@tdcosta100
tdcosta100 / WSL2GUIXvnc-en.md
Last active October 5, 2024 12:43
A tutorial to use GUI in WSL2 replacing original XServer by Xvnc, allowing WSL to work like native Linux, including login screen

WSL2 with GUI using Xvnc

Note

If you want to use pure WSLg, you can try the new WSLg (XWayland) tutorial or the WSLg (Wayland) tutorial.

In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, UVNC, etc, all of them might work flawlessly).

The key component we need to install is the desktop metapackage you want (GNOME, KDE, Xfce, Budgie, etc) and tigervnc-standalone-server.

For this setup, I will use Ubuntu (20.04, 22.04 and 24.04 are working), and install GNOME Desktop. Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the [Sample

@batisteo
batisteo / django-docs-dark.css
Last active February 2, 2022 20:47
Dark theme for Django framework website djangoproject.com
@-moz-document domain("djangoproject.com") {
/* Fork or comment on: https://gist.github.com/batisteo/4f4c1552ba18ffa51a4b8bfb527c9673 */
/* License: http://www.wtfpl.net/txt/copying */
body,
[role="main"],
.mdzr-boxshadow.container.sidebar-right {
background: #222 !important;
}
@Painezor
Painezor / Checks.py
Last active April 18, 2024 05:22
Built-in Checks for the commands extension of discord py
@commands.guild_only()
# Command cannot be used in private messages.
@commands.dm_only()
# Command can only be used in private messages.
@commands.is_owner()
# Command can only be used by the bot owner.
@commands.is_nsfw()
@EvieePy
EvieePy / error_handler.py
Last active August 14, 2024 17:13
Simple Error Handling for ext.commands - discord.py
"""
If you are not using this inside a cog, add the event decorator e.g:
@bot.event
async def on_command_error(ctx, error)
For examples of cogs see:
https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be
For a list of exceptions:
https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#exceptions
@Francesco149
Francesco149 / osu_on_linux_overhaul.md
Last active September 24, 2024 00:25
Ultimate guide to low-latency osu on linux
@levi
levi / riot_esports_api.md
Last active July 8, 2024 22:51
Riot LoL eSports Unofficial API Documentation
@sloria
sloria / bobp-python.md
Last active October 15, 2024 08:20
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@issackelly
issackelly / gist:928783
Created April 19, 2011 16:48
Django Template {{ block.super }} example
# Template: A.html
<html>
<head></head>
<body>
{% block hello %}
HELLO
{% endblock %}
</body>
</html>