Skip to content

Instantly share code, notes, and snippets.

View lmgeorge's full-sized avatar

Lauren George lmgeorge

View GitHub Profile
@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
@jonikarppinen
jonikarppinen / Messages.java
Last active February 23, 2021 23:36
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;
@dkandalov
dkandalov / plugin.groovy
Last active September 19, 2022 12:41
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 August 29, 2015 14:02
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
@CortYuming
CortYuming / us-option-specific-special-char-blank.keylayout
Last active October 28, 2016 00:59
custom keyboard mapping with option-specific-special-characters all set to BLANK in MacOSX. 1. ~/Library/Keyboard Layouts/us-option-specific-special-char-blank.keylayout 2. Enable it from System Preferences -> Language & Text -> U.S. option-specific-special-char-blank 3. restart MacOSX
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard PUBLIC "" "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<!--Created by Ukelele version 2.2.4 on 2013-10-11 at 12:40 (JST)-->
<!--Last edited by Ukelele version 2.2.4 on 2013-10-11 at 12:57 (JST)-->
<keyboard group="0" id="12456" name="U.S. option-specific-special-char-blank" maxout="1">
<layouts>
<layout first="0" last="17" modifiers="f4" mapSet="16c"/>
<layout first="18" last="18" modifiers="f4" mapSet="984"/>
<layout first="21" last="23" modifiers="f4" mapSet="984"/>
<layout first="30" last="30" modifiers="f4" mapSet="984"/>
@xkr47
xkr47 / log4j.properties
Created August 29, 2013 19:02
log4j configuration with different colors for different log levels - also works with Eclipse Ansi Console: http://mihai-nita.net/2013/06/03/eclipse-plugin-ansi-in-console/
log4j.debug=false
# Default level is INFO
log4j.rootLogger=INFO,StdoutErrorFatal,StdoutWarn,StdoutInfo,StdoutDebug,StdoutTrace
# and for com.some.package.* log everything
log4j.logger.com.some.package=TRACE
log4j.appender.StdoutErrorFatal=org.apache.log4j.ConsoleAppender
log4j.appender.StdoutErrorFatal.layout=org.apache.log4j.PatternLayout
@jmruc
jmruc / README.md
Created June 24, 2013 19:19
Generating pom.xml from gradle

To generate a pom.xml file just run gradle writeNewPom

If you want to generate it as pom.xml in the root of the project, replace writeTo("$buildDir/newpom.xml") with writeTo("pom.xml")