Skip to content

Instantly share code, notes, and snippets.

@dgageot
dgageot / PhantomJsDownloader.java
Last active May 28, 2019
PhantomJs / GhostDriver / FluentLenium with automatic install of PhantomJs
View PhantomJsDownloader.java
package com.fractales.synchro.helpers.phantomjs;
import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
import com.google.common.io.InputSupplier;
import com.google.common.io.OutputSupplier;
import com.google.common.io.Resources;
import java.io.File;
import java.io.FileOutputStream;
@kesor
kesor / Gemfile
Last active Sep 30, 2019
Vagrantfile to create a chef-server (11.x) and a client box that uses it.
View Gemfile
source :rubygems
gem 'json', '= 1.5.4' # knife/chef 11.0 and 11.20 is broken with json 1.5.5/1.7.7
gem 'vagrant'
gem 'vagrant-hostmaster'
@Hydrotoast
Hydrotoast / AdversarialSearchAI.java
Last active Dec 10, 2015
An pseudocode AI demonstrating the Minimax algorithm. Note that the algorithm has two helper functions: min and max.
View AdversarialSearchAI.java
class AdversarialSearchAI {
private PieceType piece;
public AdversarialSearchAI(PieceType piece) {
this.piece = piece;
}
/**
* Returns the best move given the state of the game
*/
@fnichol
fnichol / 00_README.md
Created Dec 20, 2012
Chef Metadata Chopper!
View 00_README.md

MetadataChopper

MetadataChopper.extract('metdata.rb') # => [ "rvm", "0.9.1" ]
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jtimberman
jtimberman / gist:3088517
Last active Feb 7, 2018
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
View gist:3088517
% 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
@sperlic
sperlic / fabfile.py
Created May 13, 2012 — forked from whiteinge/fabfile.py
Example fabric script with VirtualBox automation
View fabfile.py
# -*- 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
@krosenvold
krosenvold / gist:2508909
Created Apr 27, 2012
Try this on your multimodule maven build and watch the performance difference !
View gist:2508909
<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>
@jtimberman
jtimberman / rename-node.rb
Created Mar 2, 2012 — forked from mpasternacki/rename-node.rb
A knife exec script to change Chef node's name.
View rename-node.rb
#!./bin/knife exec
# A knife exec script to change chef node's name, preserving all the attributes.
#
# Usage: knife exec rename-node.rb old-name new-name
#
# Script retrieves the Node object, changes its 'name' attribute,
# creates new Node object with updated name and rest of attributes
# untouched. Then it deletes old Node and Client objects from
# database, and logs into the server to update it:
@chowey
chowey / syntax.js
Created Feb 18, 2012
Jade Syntax Checker
View syntax.js
var jade = require('jade'),
runtime = require('jade/lib/runtime'),
spawn = require('child_process').spawn,
fs = require('fs');
function parse(str, filename){
var options = {filename: filename, compileDebug: true};
try {
// Parse
var parser = new jade.Parser(str, filename, options)