Skip to content

Instantly share code, notes, and snippets.

View cedricvidal's full-sized avatar

Cedric Vidal cedricvidal

View GitHub Profile
import junit.framework.TestCase;
import org.junit.runner.RunWith;
import org.junit.runners.AllTests;
import junit.framework.TestSuite;
@RunWith(AllTests.class)
public final class MasterTester {
public static TestSuite suite() {
TestSuite suite = new TestSuite();

TLDR: I now add the following snippet to all my Dockerfiles:

# If host is running squid-deb-proxy on port 8000, populate /etc/apt/apt.conf.d/30proxy
# By default, squid-deb-proxy 403s unknown sources, so apt shouldn't proxy ppa.launchpad.net
RUN route -n | awk '/^0.0.0.0/ {print $2}' > /tmp/host_ip.txt
RUN echo "HEAD /" | nc `cat /tmp/host_ip.txt` 8000 | grep squid-deb-proxy \
  && (echo "Acquire::http::Proxy \"http://$(cat /tmp/host_ip.txt):8000\";" > /etc/apt/apt.conf.d/30proxy) \
  && (echo "Acquire::http::Proxy::ppa.launchpad.net DIRECT;" >> /etc/apt/apt.conf.d/30proxy) \
  || echo "No squid-deb-proxy detected on docker host"
@cedricvidal
cedricvidal / Vagrantfile
Created February 6, 2014 00:19
Ubuntu Raring Vagrantfile
Vagrant::Config.run do |config|
config.vm.box = "raring"
config.vm.box_url = "http://cloud-images.ubuntu.com/raring/current/raring-server-cloudimg-vagrant-amd64-disk1.box"
config.vm.share_folder("vagrant-root", "/vagrant", ".")
config.vm.customize ["modifyvm", :id, "--memory", 2048]
end
@cedricvidal
cedricvidal / .bash_profile
Created January 21, 2014 13:46
Set JDK Bash helper
function setjdk() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
fi
export JAVA_HOME=`/usr/libexec/java_home -v $@`
export PATH=$JAVA_HOME/bin:$PATH
fi
echo JAVA_HOME set to $JAVA_HOME
@cedricvidal
cedricvidal / jolokia-camel-queries.md
Last active January 1, 2016 06:09
Jolokia Camel queries

Queries Load01, InflightExchanges and LastProcessingTime of all routes

http://localhost:9180/jolokia/read/org.apache.camel:context=*,type=routes,name=*/Load01,InflightExchanges,LastProcessingTime

Queries the current queue size of queue backed endpoints (selects only endpoints which are backed by a queue such as vm and seda)

http://localhost:9180/jolokia/read/org.apache.camel:context=*,type=endpoints,name=*/CurrentQueueSize
@cedricvidal
cedricvidal / .gitconfig
Last active November 28, 2017 17:41
.gitconfig
[user]
name = Cedric Vidal
email = [email protected]
[color]
ui = true
[alias]
lg = log --all --graph --decorate --oneline
undo = reset --soft HEAD^
/**
* @ngdoc overview
* @name AUTO
* @description
*
* Implicit module which gets automatically added to each {@link AUTO.$injector $injector}.
*/
var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
var FN_ARG_SPLIT = /,/;
@cedricvidal
cedricvidal / backup.sh
Last active January 17, 2022 16:26 — forked from nherment/backup.sh
ElasticSearch log index backup & restore scripts
#!/bin/bash
# herein we backup our indexes! this script should run at like 3 AM every first day of the month, after logstash
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas,
# compress the data files and backs up to whatever long term storage.
. ./config.sh
echo "Checking that index exist in ES"
if [ `curl -sI $ESURL/$INDEXNAME | grep OK | wc -l` -eq 0 ]
then
@cedricvidal
cedricvidal / underscore.ext.js
Created November 25, 2012 17:58
Some Underscore.js extensions
/*
* @author <a href="mailto:cedric at vidal dot biz">Cedric Vidal</a>
*/
_.mixin({
and : function() {
var funcs = arguments;
return function() {
var args = arguments;
return _.all(_.map(funcs, function(f) {return f.apply(this, args);}), _.identity);
@cedricvidal
cedricvidal / .gitignore
Created November 24, 2012 09:25 — forked from adamgit/.gitignore
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude
#
# For updates, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#########################