Skip to content

Instantly share code, notes, and snippets.

@ctechols
ctechols / compinit.zsh
Last active May 8, 2025 03:56
Speed up zsh compinit by only checking cache once a day.
# On slow systems, checking the cached .zcompdump file to see if it must be
# regenerated adds a noticable delay to zsh startup. This little hack restricts
# it to once a day. It should be pasted into your own completion file.
#
# The globbing is a little complicated here:
# - '#q' is an explicit glob qualifier that makes globbing work within zsh's [[ ]] construct.
# - 'N' makes the glob pattern evaluate to nothing when it doesn't match (rather than throw a globbing error)
# - '.' matches "regular files"
# - 'mh+24' matches files (or directories or whatever) that are older than 24 hours.
autoload -Uz compinit
@parmentf
parmentf / GitCommitEmoji.md
Last active May 9, 2025 10:13
Git Commit message Emoji
@nacx
nacx / Overlap.java
Last active March 22, 2024 17:32
Network overlapping check
private static boolean overlap(final String net1, final String net2)
{
SubnetInfo subnet1 = new SubnetUtils(net1).getInfo();
SubnetInfo subnet2 = new SubnetUtils(net2).getInfo();
int mask1 = subnet1.asInteger(subnet1.getNetmask());
int mask2 = subnet2.asInteger(subnet2.getNetmask());
int maskToUse = mask1 < mask2 ? mask1 : mask2;
int addr1 = subnet1.asInteger(subnet1.getAddress()) & maskToUse;
when().
get(getDriverListFor2016).
then().
body("findAll{Drivers->Drivers.permanentNumber >= '%s' && Drivers.permanentNumber <= '%s' }.permanentNumber",
withArgs(lowerLimit, upperLimit), allOf(hasItem(inCollection), not(hasItem(notInCollection))));
when().
get(getDriverListFor2016).
then().
body("findAll{Drivers->Drivers.permanentNumber >= '%s' && Drivers.permanentNumber <= '%s' }.permanentNumber", withArgs(lowerLimit", upperLimit), hasItem(inCollection)).
body("findAll{Drivers->Drivers.permanentNumber >= '%s' && Drivers.permanentNumber <= '%s' }.permanentNumber", withArgs(lowerLimit, upperLimit), not(hasItem(notInCollection)));
when().
get(getDriverListFor2016).
then().
root("findAll{Drivers->Drivers.permanentNumber >= '%s' && Drivers.permanentNumber <= '%s' }.permanentNumber").
body(withArgs(lowerLimit, upperLimit), hasItem(inCollection)).
body(withArgs(lowerLimit, upperLimit), not(hasItem(notInCollection)));
@medvedev
medvedev / build.gradle
Last active January 14, 2025 09:54
Gradle task that prints total dependencies size and (dependency+(size in kb)) list sorted by size desc
...
/* Tested with Gradle 6.3 */
tasks.register("depsize") {
description = 'Prints dependencies for "default" configuration'
doLast() {
listConfigurationDependencies(configurations.default)
}
}
@vincent-zurczak
vincent-zurczak / JSonBindingUtils.java
Created August 24, 2016 18:26
Generating swagger.json files with Enunciate and custom objects mappers
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
@guiguegon
guiguegon / CustomPlugin.groovy
Created September 22, 2016 06:20
Gradle rename plugin
class CustomPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
project.task('renameAppVersionName', type: RenameAppVersionNameTask)
project.tasks.getByName('preBuild').dependsOn('renameAppVersionName')
}
}
@inC3ASE
inC3ASE / SandboxBag
Created October 20, 2016 20:57
Library/Caches/com.apple.appstore
 streamtypedÅËÑ@ÑÑÑNSMutableDictionaryÑÑ NSDictionaryÑÑNSObjectÖÑiíÑÑÑNSStringïÑ+bagÜíÑÑÑ
NSMutableDataÑÑNSDataïñÇXƒÑ [115800c]<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>search</key><string>https://search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search</string>
<key>advancedSearch</key><string>https://search.itunes.apple.com/WebObjects/MZSearch.woa/wa/advancedSearch?cc=us</string>
<key>searchHints</key><string>https://search.itunes.apple.com/WebObjects/MZSearchHints.woa/wa/hints</string>
<key>searchApi</key><string>https://search.itunes.apple.com/WebObjects/MZSearch.woa/wa/searchApi</string>
<key>p2-book-search</key><string>https://search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?media=ebook</string>