This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="xml"/> | |
<xsl:template match="/wx_station_index"> | |
<kml xmlns="http://www.opengis.net/kml/2.2"> | |
<Document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is a tool to control contactsd on macOS. For some reason, contactsd | |
# consumes a lot of CPU when running against my (large, 9,779 entry) | |
# addressbook. I think contactsd is responsible for synchronizing the | |
# addressbook in the background, but it makes my local instance of the Contacts | |
# app hang and burns up my battery. So I stop contactsd when I use the Contacts | |
# app and then restart it to allow the sync to happen. However, modern macOS | |
# will not allow one to disable the contactsd launch agent. System Integrity | |
# Protection will also not allow one to disable it. So what I really do is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is a tool to control contactsd on macOS. For some reason, contactsd | |
# consumes a lot of CPU when running against my (large, 9,779 entry) | |
# addressbook. I think contactsd is responsible for synchronizing the | |
# addressbook in the background, but it makes my local instance of the Contacts | |
# app hang and burns up my battery. So I stop contactsd when I use the Contacts | |
# app and then restart it to allow the sync to happen. However, modern macOS | |
# will not allow one to stop the contactsd launch agent to be disabled. System | |
# Integrity Protection will not allow one to disable it. So what I really do is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select individual_contribution."EMPLOYER" as employer, sum(individual_contribution."TRANSACTION_AMT") as total_contribution from individual_contribution where "ENTITY_TP"='IND' group by individual_contribution."EMPLOYER" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Find the top ten PACs by total contributions from individuals with no employer listed. | |
select b.cmte_nm as committee_name, a.committee_ID, a.total_contribution | |
from (select individual_contribution."CMTE_ID" as committee_ID, sum(individual_contribution."TRANSACTION_AMT") | |
as total_contribution from individual_contribution | |
where "ENTITY_TP"='IND' and ("EMPLOYER" in ('NONE', 'UNEMPLOYED', 'NOT EMPLOYED', 'N/A', 'NO EMPLOYER', 'NONE GIVEN') | |
or "EMPLOYER" is null) group by individual_contribution."CMTE_ID") | |
as a join committee | |
as b on a.committee_ID = b.cmte_id | |
order by total_contribution desc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Show the differences between two Microsoft Word files. | |
echo Detecting differences between $1 and $2. | |
echo MD5 hashes: | |
md5 "$1" "$2" | |
# Unpack the contents of the documents. The Word .docx format is a ZIP file containing XML files. | |
mkdir "$1".contents |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a gross hack to make it possible to run without any fonts in the Lambda environment. | |
private static void configureStubFontConfiguration() { | |
final Properties p = new Properties(); | |
p.put("version", "1"); | |
p.put("sequence.allfonts", "nonexistent"); // Just need at least one entry to satisfy FontManager. | |
try { | |
final File targetFile = File.createTempFile("fontconfig.properties", null); | |
targetFile.deleteOnExit(); | |
try (FileOutputStream o = new FileOutputStream(targetFile)) { | |
p.store(o, "stub to make sun.awt.FontConfiguration not break when no fonts are available"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Eagerly execute some initialization such as loading of standard fonts. | |
*/ | |
public static void initializePDFRenderer() { | |
final PDDocument document = new PDDocument(); | |
new PdfBoxFontResolver(null, document, null, PdfRendererBuilder.PdfAConformance.NONE, false); | |
try { | |
document.close(); | |
} catch (final IOException e) { | |
throw new RuntimeException(e); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.jupiter.api.Test; | |
import org.junit.platform.commons.support.AnnotationSupport; | |
import org.junit.platform.commons.support.HierarchyTraversalMode; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Modifier; | |
import java.util.List; | |
import java.util.logging.Logger; | |
import static org.junit.jupiter.api.Assertions.assertEquals; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.jupiter.api.Test; | |
import static org.junit.jupiter.api.Assertions.*; | |
public class Account { | |
public static class InsufficientFundsException extends Exception { | |
} | |
private int balance; |
NewerOlder