Skip to content

Instantly share code, notes, and snippets.

View soberich's full-sized avatar

soberich

  • Amsterdam, The Netherlands
View GitHub Profile
@nonrational
nonrational / ReflectionsHelper.java
Created September 9, 2015 16:08
Suppress WARN org.reflections.Reflections could not create Vfs.Dir from url
package com.betterment.common;
import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.reflections.vfs.Vfs;
import com.google.common.collect.Lists;
@pudquick
pudquick / recentServersSFL.py
Last active June 16, 2025 19:37
Working with SharedFileList (.sfl) files from OSX 10.11 El Capitan in python
from Foundation import NSKeyedUnarchiver
from struct import unpack
# This entire function is black magic of the highest order and I'll blog about it later
def extract_share(bookmark_data):
content_offset, = unpack('I', bookmark_data[12:16])
first_TOC, = unpack('I', bookmark_data[content_offset:content_offset+4])
first_TOC += content_offset
TOC_len, rec_type, level, next_TOC, record_count = unpack('IIIII', bookmark_data[first_TOC:first_TOC+20])
TOC_cursor = first_TOC + 20
@v1m
v1m / .curlrc
Last active January 30, 2025 09:32
sample .curlrc file
# this is a sample .curlrc file
# https://everything.curl.dev/ is a GREAT RESOURCE
# store the trace in curl_trace.txt file. beware that multiple executions of the curl command will overwrite this file
--trace curl_trace.txt
# store the header info in curl_headers.txt file. beware that multiple executions of the curl command will overwrite this file
--dump-header curl_headers.txt
#change the below referrer URL or comment it out entirely
@ctechols
ctechols / compinit.zsh
Last active June 25, 2025 13:13
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 July 12, 2025 15:26
Git Commit message Emoji
import Foundation
/**
Set FourCharCode/OSType using a String.
Examples:
let test: FourCharCode = "420v"
let test2 = FourCharCode("420f")
print(test.string, test2.string)
*/
@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)));