Skip to content

Instantly share code, notes, and snippets.

@Pinsplash
Pinsplash / bombtype3.cfg
Created September 7, 2024 13:46
Portal 2: Make all gel conversion gel without modifying maps
ent_fire prop_paint_bomb addoutput "painttype 3"
@tdcosta100
tdcosta100 / WSL2GUIWSLg-XWayland-en.md
Last active April 21, 2025 12:13
A tutorial to use GUI in WSL2/WSLg replacing original Xorg by Xwayland, allowing WSL to work like native Linux, including login screen

Full desktop shell in WSL2 using WSLg (XWayland)

Note

If you want to use Wayland in WSLg in a simpler setup, you can try the WSLg (Wayland) tutorial.

In this tutorial, we will setup GUI in WSL2. No additional software outside WSL (like VcXsrv or GWSL) is required. You will find this tutorial very similar to the one that replaces Xorg with Xvnc. Indeed, it's pretty much the same tutorial, with some few changes.

The key component we need to install is the desktop metapackage you want (GNOME, KDE, Xfce, Budgie, etc), and after that, replace the default Xorg by a script that calls Xwayland instead.

For this setup, I will use Ubuntu 24.04, and install GNOME Desktop. Unfortunately older versions of Ubuntu lack some fundamental things, so we cannot reproduce it in older versions (at least not fully). Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the [Sample screenshot

#!/usr/bin/python3
"""
WARNING: The code you are about to view is DISGUSTING
I wrote most of it months ago, so don't ask me what it's doing, or why.
"""
import struct
import sys
@matthewjberger
matthewjberger / vs2017.json
Created March 15, 2018 20:44
Beginning of a scoop installer for visual studio 2017 community edition. Uninstall doesn't work
{
"version": "15.6.2",
"url": "https://aka.ms/vs/15/release/vs_community.exe",
"homepage": "https://www.visualstudio.com/",
"checkver": {
"url": "https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2017-relnotes",
"re": "Visual Studio 2017 version (\\d+\\.\\d+\\.\\d+)"
},
"autoupdate": {
"url": "https://aka.ms/vs/15/release/vs_community.exe"
@rickdog
rickdog / cross-domainYQL.js
Last active September 23, 2020 22:36
x-domain using YQL
// callback is optional, since jQuery has promises
function getFile(theURL, type, callback)
{
/*
* Original jQuery.ajax mid - CROSS DOMAIN AJAX
* @author James Padolsey (http://james.padolsey.com)
* @updated 12-JAN-10
* @info http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/
* source: https://raw.github.com/padolsey/jquery.fn/master/cross-domain-ajax/jquery.xdomainajax.js
*
@fiftin
fiftin / Convert PostgreSQL to SQLite
Created October 5, 2015 07:04
Convert PostgreSQL to SQLite
1. Dump the data only sql to file
$ pg_dump --data-only --inserts YOUR_DB_NAME > dump.sql
2. scp to local
3. Remove the SET statements at the top
such as:
SET statement_timeout = 0;
SET client_encoding = 'SQL_ASCII';
4. Remove the setval sequence queries
@nevkontakte
nevkontakte / CLion_Ninja.md
Last active July 10, 2024 09:02
Ninja support for CLion IDE

Ninja support for CLion IDE

This script enables Ninja-powered builds in CLion IDE by wrapping around CMake, which it uses. See my blog post for details.

Disclaimer

This script is provided AS IS with no guarantees given or responsibilities taken by the author. This script relies on undocumented features of CLion IDE and may lead to instability of build and/or IDE. Use it on your own risk under WTFPL terms.

@nolanlawson
nolanlawson / protips.js
Last active November 19, 2024 02:40
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@Asparagirl
Asparagirl / gist:6206247
Last active January 28, 2025 14:38
Have a WARC that you would like to upload to the Internet Archive so that it can eventually be included in their Wayback Machine? Here's how to upload it from the command line.

Do you have a WARC file of a website all downloaded and ready to be added to the Internet Archive? Great! You can do that with the Internet Archive's web-based uploader, but it's not ideal and it can't handle really big uploads. Here's how you can upload your WARC files to the IA from the command line, and without worrying about a size restriction.

First, you need to get your Access Key and Secret Key from the Internet Archive for the S3-like API. Here's where you can get that for your IA account: http://archive.org/account/s3.php Don't share those with other people!

Here's their documentation file about how to use it, if you need some extra help: http://archive.org/help/abouts3.txt

Next, you should copy the following files to a text file and edit them as needed:

export IA_S3_ACCESS_KEY="YOUR-ACCESS-KEY-FROM-THE-IA-GOES-HERE"