Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Crossfield mrmanc

View GitHub Profile
@mrmanc
mrmanc / disable-macos-man-page-shortcuts.md
Last active Apr 25, 2022
Turn off annoying macOS man page shortcuts via the command line
View disable-macos-man-page-shortcuts.md

Turn off annoying macOS man page shortcuts via the command line

Context

macOS 10.14.4 introduced a keyboard shortcut that conflicts with one of IntelliJ IDEA’s best shortcuts. cmd-shift-a pops open a Terminal window running an apropos search on the text selection, rather than the command palette.

You can manually disable these keyboard shortcuts via System Preferences, but this script does this programmatically. I was unable to find any existing information about how to do this via the command line, so I rolled my own solution.

It took a long time to work out which defaults domain to find the plist for this. I probably worked out the pbs domain from this post.

@mrmanc
mrmanc / folder-structure-liquid-jekyll
Created Aug 24, 2017
WIP to create a directory structure in a list for a Jekyll site
View folder-structure-liquid-jekyll
{% assign level = 0 %}
{% assign previous_level = 1 %}
{% assign sorted_pages = site.pages | sort:'url' %}
{% for page in sorted_pages %}
{% assign level = page.dir | split:"/" | size | minus:1 %}
{% if level > previous_level %}
<ul>
{% elsif level < previous_level %}
</ul>
{% endif %}
@mrmanc
mrmanc / gist:14bdf23b4bd0ab868e90ddb723404685
Last active Jul 29, 2017
macos top snapshot with cpu
View gist:14bdf23b4bd0ab868e90ddb723404685
top -stats pid,cpu,command -l 2 -o cpu | awk 'BEGIN{sampleNumber=0} /^PID/ {sampleNumber += 1;} {if (sampleNumber == 2) {print $0}}'
View D20BAEAA64554E0BAB202019343671CF
Exception: Exception caught in LocalLB::urn:iControl:LocalLB/Pool::remove_member_v2()
Exception: Common::OperationFailed
primary_error_code : 16908342 (0x01020036)
secondary_error_code : 0
error_string : 01020036:3: The requested Pool Member (/Production/shippr_live_shippr-application_94d3b798f708dec8413fe75e3025d41ec72f0a90.2692_a4cce7eb-0e5f-4397-b4a6-35efa0c09311 /Production/shippr_live_shippr-application_94d3b798f708dec8413fe75e3025d41ec72f0a90.2692_172.28.139.102 8080) was not found.
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
@mrmanc
mrmanc / 1AB6305599F94840A97F3E51A04DDF7C
Created Nov 16, 2016
Missing cause type in stacktrace
View 1AB6305599F94840A97F3E51A04DDF7C
Exception: uk.co.autotrader.shippr.f5.F5AuthorisationException: Authorisation failed whilst trying to Remove pool members from pools 'XXXXXXXXXX, XXXXXXXXXX' using F5 user 'XXXXXXXXXX
Caused by: (401)F5 Authorization Required
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
@mrmanc
mrmanc / 1AB6305599F94840A97F3E51A04DDF7C
Created Nov 16, 2016
Missing cause type in stacktrace
View 1AB6305599F94840A97F3E51A04DDF7C
Exception: uk.co.autotrader.shippr.f5.F5AuthorisationException: Authorisation failed whilst trying to Remove pool members from pools 'XXXXXXXXXX, XXXXXXXXXX' using F5 user 'XXXXXXXXXX
Caused by: (401)F5 Authorization Required
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
@mrmanc
mrmanc / gist:5bcbe80549393d1b9ea13c7b3e8974ac
Created May 29, 2016
JUnit test with multiple anonymous and separately scoped scenarios in one method
View gist:5bcbe80549393d1b9ea13c7b3e8974ac
import org.junit.Rule;
import org.junit.rules.ErrorCollector;
import static org.assertj.core.api.Assertions.assertThat;
public class ReverseTest {
@Rule
public ErrorCollector collector = new ErrorCollector();
View gist:1758d6ad04f45944e89056cf83649d86
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>vending_machine_java_refuctored</artifactId>
<version>1.0-SNAPSHOT</version>
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object: