Skip to content

Instantly share code, notes, and snippets.

@fsouza
fsouza / add_prefix.py
Created September 8, 2011 23:01
Removes prefix to your contacts on Google Contacts
# -*- coding: utf-8 -*-
import gdata.contacts.client
import gdata.contacts.data
USER = ""
PASSWD = ""
PREFIX = '041'
def add_prefix_to_contacts(gd_client, prefix):
@smileart
smileart / README.md
Last active March 16, 2024 15:42 — forked from agnoster/README.md
My ZSH Theme — Agnoster Mod

My modified fork of agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

Compatibility

@jirutka
jirutka / MOXyContextResolver.java
Created March 27, 2013 15:47
EclipseLink MOXy helpers for better handling of namespaces.
/* Copyright 2013 Jakub Jirutka. All rights reserved.
*
* "THE KOFOLA-WARE LICENSE" (Revision 1):
* Jakub Jirutka originally wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a Kofola in return. <jakub@jirutka.cz>
*/
import java.io.File;
import java.io.FileNotFoundException;
@edwardbeckett
edwardbeckett / build.gradle
Created April 13, 2013 06:59
mysema.querydsl gradle
sourceSets {
generated {
java {
srcDirs = ['src/main/generated']
}
}
}
configurations {
querydslapt
@thom-nic
thom-nic / build.gradle
Last active November 16, 2023 07:35
find the largest classnames in Spring libraries. Also find FactoryFactories
/**
* Find the longest class names in Spring.
* Also find FactoryFactory classes.
* a goof-off project by @thom_nic
*/
import java.util.jar.*
defaultTasks 'longest', 'factoryfactory'
@raphw
raphw / FieldBenchmark.java
Last active March 4, 2024 00:14
Java MethodHandle and reflection benchmark
package benchmark;
import org.openjdk.jmh.annotations.*;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.TimeUnit;
@aaronanderson
aaronanderson / ContainerSecurityFilter.java
Last active March 10, 2018 15:05
JAX-RS 2.0 ContainerRequestFilter that performs the LinkedIn Exchange of JSAPI Tokens for REST API OAuth Tokens
import java.io.IOException;
import java.io.StringReader;
import java.net.URLDecoder;
import java.security.Principal;
import java.util.Base64;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.Priority;
@raphw
raphw / LogInterceptor.java
Created February 23, 2015 14:11
Byte Buddy agent: JDK 8
package introspect;
import net.bytebuddy.instrumentation.method.bytecode.bind.annotation.AllArguments;
import net.bytebuddy.instrumentation.method.bytecode.bind.annotation.Origin;
import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicInteger;
public class LogInterceptor {
apply plugin: 'java'
apply plugin: 'java-library-distribution'
repositories {
mavenCentral()
}
dependencies {
compile 'org.apache.commons:commons-lang3:3.3.2'
}
@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