Skip to content

Instantly share code, notes, and snippets.

@tbroyer
tbroyer / OkHttpClientEngine.java
Last active May 31, 2022 07:19
Use OkHttp as JAX-RS Client implementation with RESTEasy
/*
* Copyright 2015 Thomas Broyer
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@alex-shpak
alex-shpak / Interceptor.java
Last active June 14, 2024 02:40
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON
@bruienne
bruienne / gist:8953146ada5540cb7d29
Last active April 2, 2025 18:42
10.9.5 SystemAdministration dependencies
/usr/bin/tmutil
/usr/libexec/aosnotifyd
/usr/libexec/mdmclient
/usr/libexec/transition
/usr/sbin/networksetup
/usr/sbin/systemsetup
/System/Library/CoreServices/Directory Utility.app/Contents/MacOS/Directory Utility
/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
/System/Library/CoreServices/KeyboardSetupAssistant.app/Contents/Resources/common.bundle/Contents/MacOS/common
/System/Library/CoreServices/Language Chooser.app/Contents/MacOS/Language Chooser
@gAmUssA
gAmUssA / jsr223Factories.groovy
Last active March 1, 2025 18:30
List All Scripting Engine Factories with JavaScript
import javax.script.ScriptEngine
import javax.script.ScriptEngineFactory
import javax.script.ScriptEngineManager;
//System.properties.each { k, v -> println("$k = $v") }
println System.properties['java.runtime.version']
println "---------------------------------"
ScriptEngineManager manager = new ScriptEngineManager()
ScriptEngine nashorn = manager.getEngineByName("nashorn")
if (nashorn != null) {
@janbrohl
janbrohl / gist:a8543721de2ac10f0a07
Last active January 3, 2025 19:25
Metalink generator
#!/usr/bin/python2
from urlparse import parse_qsl
from xml.sax.saxutils import escape,quoteattr
__version__="0.9"
__author__="Jan Brohl <[email protected]>"
__license__="BSD-3-Clause"
def _first_qst(qst,key):
@githubutilities
githubutilities / Uninstall-pkg.md
Last active March 13, 2025 14:47
Uninstall pkg manually in OS X

Mac Uninstall pkg Manually

  • using pkgutil
# list all your installed packages
pkgutil --pkgs

# show your package info
pkgutil --pkg-info 
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 5, 2025 01:35
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@chris-79
chris-79 / set-date-time-formats.sh
Created August 6, 2015 14:30
Set my preferred date and time formats on OS X
# declare my US locale
defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD"
defaults write com.apple.systempreferences AppleIntlCustomFormat -dict-add "AppleIntlCustomLocale" "en_US"
# date string formats
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "1" "yyyy/MM/dd"
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "2" "dd MMM y"
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "3" "dd MMMM y"
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict-add "4" "EEEE, dd MMMM y"
@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;
@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