Skip to content

Instantly share code, notes, and snippets.

@jtimberman
jtimberman / gist:3088517
Last active February 7, 2018 16:40
Replace $VAGRANTBOX with box names that should be repackaged with updates. Don't specify it for up, ssh, and package if you're not using a multi-VM vagrantfile
% vagrant up --no-provision $VAGRANTBOX
% vagrant ssh $VAGRANTBOX
vagrant$ wget -O - http://opscode.com/chef/install.sh | sudo bash
vagrant$ rm /tmp/chef*{rpm,deb}
vagrant$ exit
% vagrant package $VAGRANTBOX
% rm -rf ~/.vagrant.d/boxes/$VAGRANTBOX
% vagrant box add $VAGRANTBOX package.box
require 'rubygems'
require 'sequel'
require 'fileutils'
# NOTE: This converter requires Sequel and the MySQL gems.
# The MySQL gem can be difficult to install on OS X. Once you have MySQL
# installed, running the following commands should work:
# $ sudo gem install sequel
# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
@whiteinge
whiteinge / fabfile.py
Created November 13, 2009 17:16
Example fabric script with VirtualBox automation
# -*- coding: utf-8 -*-
"""MyCompany Fabric script.
* Deploy code
* Set up a local development environment
There are two ways to deploy the myrepo code:
1. :func:`deploy` will do a full virtualenv installation/update and expand a
tarball of the specified git revision (defaults to HEAD) to a timestamped
@arthurtsang
arthurtsang / DynamicServiceActivator.java
Created March 29, 2013 01:21
Create a Spring Integration Channel programatically and register that as a Spring bean
private SubscribableChannel createInputChannel(String inputChannelName) {
PublishSubscribeChannel channel = new PublishSubscribeChannel();
channel.setBeanName(inputChannelName);
channel.setBeanFactory(applicationContext);
//channel.setApplySequence(true);
((ConfigurableApplicationContext)applicationContext).getBeanFactory().registerSingleton(inputChannelName, channel);
return channel;
}
@krosenvold
krosenvold / gist:2508909
Created April 27, 2012 12:43
Try this on your multimodule maven build and watch the performance difference !
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
.....
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac</artifactId>
<version>1.8.6</version>
</dependency>

If you plan to attend this workshop in a conference, as network availibility is often flaky, please check you have the following :

  • A laptop + cord
  • Install docker 1.11
    • Install with Toolbox for windows or for Mac
    • If you haven't done it already, register for the Docker for desktop beta at https://beta.docker.com, and give us your hub account name during the session we can probably do something for you.
  • Test your docker installation works fine
    • docker run hello-world and check you see the welcome message
    • docker run -p 8080:80 nginx and open your browser to your machine on port 8080 and check you see nginx default page.
  • Warm up your local docker machine with the following images :
  • docker pull dockerdemos/lab-web
@aheritier
aheritier / setMaven.sh
Created May 29, 2013 08:03
Script to switch between various Maven versions (One day perhaps we may have a renv, jenv, like ...) Works on MacOs Put your Maven installations under $MVN_VERSIONS_DIRECTORY
#!/bin/bash
MVN_VERSIONS_DIRECTORY="/Users/arnaud/Applications/"
MVN_DIRECTORY_TEMPLATE="apache-maven-"
versions=`ls -1 ${MVN_VERSIONS_DIRECTORY} | grep ${MVN_DIRECTORY_TEMPLATE}'[2-9].[0-9]' | sed 's/^.*maven-//g'`
echo -e "\033[1;32mAvailable Versions:\033[0m " $versions
if [ "$1" == "" ]; then
exit
fi
var config = {
"database": {
"connection": "mongodb://localhost/scrapService"
},
"cookieSecret": "EhAIj3NmtJ1sem5StHXV0Mk"
};
require("./user")
var express = require('express')
, mongoose = require('mongoose')
, User = mongoose.models["User"]
What kind of new features would you be happy to see in Apache Maven new major release ?
@Hydrotoast
Hydrotoast / AdversarialSearchAI.java
Last active December 10, 2015 15:18
An pseudocode AI demonstrating the Minimax algorithm. Note that the algorithm has two helper functions: min and max.
class AdversarialSearchAI {
private PieceType piece;
public AdversarialSearchAI(PieceType piece) {
this.piece = piece;
}
/**
* Returns the best move given the state of the game
*/