To use this snippet first replace the _default
in the URL with your environment name if you are using somethign other than the global default. Next in the run list, replace ...
with your cookbook names. Unlike other run lists, you cannot have roles here, and you don't use the 'recipe[foo]'
syntax, just 'foo'
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Implicits { | |
implicit class PimpedString(str: String) { | |
def everyNthChar(skipNum: Int) = (for (i <- 0 until str.length if i%skipNum==0) yield str(i)).mkString | |
//Other methods I want strings to have go here | |
} | |
implicit class PimpedInt(int: Int){ | |
//Other methods I want ints to have do here | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.Actor | |
import akka.actor.ActorSystem | |
import akka.agent.Agent | |
import com.typesafe.config.ConfigFactory | |
import akka.event.Logging | |
import akka.actor.Props | |
import kafka.utils.Utils | |
import java.nio.ByteBuffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FakeParser | |
def self.call(body, format) | |
body | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* From a file that contains | |
* doc_id w1 w2 w3 ... lines, separated by tabs | |
* return an inverted index Map of w -> Set(doc_id) | |
* | |
* @param filename well isn't it obvious | |
* @return Map[String,Set[String]] | |
*/ | |
import scala.collection.immutable.Map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find app/code/core/Mage app/code/core/Enterprise app/code/core/Zend lib/Varien lib/Mage lib/Zend -type f | grep -v '\.svn' | sort -d -f -k1 | xargs md5sum | awk {'print $2, $1'} > 1.11.2.0.local.md5 | |
diff 1.11.2.0.base.md5 1.11.2.0.local.md5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define homebrew::tap ( | |
$ensure = present, | |
) { | |
if $ensure == 'present' { | |
exec { "homebrew_tap_${name}": | |
command => "brew tap ${name}", | |
unless => "brew tap | grep ${name}", | |
} | |
} else { | |
exec { "homebrew_untap_${name}": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from urllib2 import urlopen | |
import socket | |
from time import sleep | |
UDP_ADDRESS = "carbon.hostedgraphite.com" | |
UDP_PORT = 2003 | |
RIAK_STATS_URL='http://localhost:11098/stats' | |
HG_API_KEY='Your Api Key from HostedGraphite.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MemoizedLambdaFib { | |
interface MemoizedFunction<T, R> { | |
enum Cache { | |
_; | |
Map<Object, Object> vals = new HashMap<>(); | |
} | |
R calc(T t); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** GenerateThumbnail | |
* generate a thumbnail of an image | |
* | |
* ==Overview== | |
* {{{ | |
* val thumbnail = new Thumbnailer(.25, "image.jpg", "image-thumbnail.jpg") | |
* val resized = thumbnail.resize() | |
* thumbnail.save() | |
* }}} | |
*/ |
OlderNewer