Skip to content

Instantly share code, notes, and snippets.

View lmgeorge's full-sized avatar

lmgeorge

View GitHub Profile
@SpiritCroc
SpiritCroc / maunium_to_emote.py
Last active May 13, 2025 23:11
Convert stickers from a maunium stickerpicker to a MSC2545-enabled sticker pack to paste into /devtools, while reusing existing mxc-urls
#!/usr/bin/env python3
import argparse
import emoji
import urllib.request
import json
import sys
parser = argparse.ArgumentParser(description="Convert maunium stickerpicker to MSC2545 sticker packs")
parser.add_argument("--baseurl", help="Maunium sticker picker URL")
@danvy
danvy / WSL2-Net-Fix.ps1
Created September 5, 2020 21:04
Reset your WSL network connection trying to fix WSL2 media disconnected error
# Check these threads before proceeding:
# https://github.com/microsoft/WSL/discussions/5857
# https://github.com/microsoft/WSL/issues/5821
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
$CmdLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CmdLine
Exit
}
# Restart the Host Network Service
Restart-Service -Force -Name hns
@EmilVarona
EmilVarona / gist:78ae2aff409922686ebff4cea785aed4
Created April 13, 2017 01:28
Outlook/Mac 2015 raw query item names
<?xml version="1.0" encoding="UTF-8"?>
<schema version="1.0" xmlns="http://www.apple.com/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.apple.com/metadata file:///System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/MetadataSchema.xsd">
<!--
Compiled from /Applications/Microsoft\ Outlook.app/Contents/Library/Spotlight/Microsoft\ Outlook\ Spotlight\ Importer.mdimporter/Contents/Resources/schema.xml
with info from http://xensoft.com/search-mac-outlook-2011-mail-with-raw-queries/
-->
<types>
<type name="com.microsoft.outlook15.contact">
<allattrs>
kMDItemTitle
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active October 30, 2026 21:36
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@jonikarppinen
jonikarppinen / Messages.java
Last active November 17, 2025 06:47
Example of using message resources in Spring Boot service layer code, in as simple way as possible (hopefully!). NOTE: this approach supports only a single locale, not dynamically changing it.
package com.company.project.components;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.Locale;
@mullnerz
mullnerz / archive-website.md
Last active November 2, 2026 14:57
Archiving a website with wget

The command I use to archive a single website

wget -mpck --html-extension --user-agent="" -e robots=off --wait 1 -P . www.foo.com

Explanation of the parameters used

  • -m (Mirror) Turns on mirror-friendly settings like infinite recursion depth, timestamps, etc.
@dkandalov
dkandalov / plugin.groovy
Last active January 15, 2025 11:50
Text Munging mini-plugin
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.editor.Document
import com.intellij.testFramework.MapDataContext
import static liveplugin.PluginUtil.*
registerAction("MungeText", "ctrl alt shift M") { AnActionEvent event ->
def project = event.project
showPopupMenu([
"Group by": {
@dkandalov
dkandalov / plugin.groovy
Last active November 21, 2025 20:21
Find all transitive dependencies for modules in IDEA project (this is a mini plugin for https://github.com/dkandalov/live-plugin)
import com.intellij.openapi.module.Module
import com.intellij.openapi.module.ModuleManager
import com.intellij.openapi.roots.CompilerModuleExtension
import com.intellij.openapi.roots.LibraryOrderEntry
import com.intellij.openapi.roots.ModifiableRootModel
import com.intellij.openapi.roots.ModuleRootManager
import com.intellij.openapi.roots.OrderRootType
import com.intellij.openapi.roots.libraries.Library
import com.intellij.openapi.roots.libraries.LibraryTable
import liveplugin.PluginUtil
@nilbus
nilbus / java_for_rubyists.md
Last active January 25, 2023 18:49
Some Java basics for Rubyists
  1. Java uses static, declared typing:

    String hello = "Hello, World!";
    List<String> phrases = new ArrayList<String>;
    phrases.add(hello);
    phrases.add(null);
    phrases.add(123); // Compile error! Not a string.
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten