Skip to content

Instantly share code, notes, and snippets.

# http://cran.r-project.org/web/packages/markovchain/vignettes/an_introduction_to_markovchain_package.pdf
library(markovchain)
initialState <- c(0,1,0)
weatherStates <- c("sunny", "cloudy", "rain")
byRow <- TRUE
trans.probs <- matrix(data=c(0.7, 0.2, 0.1,
0.3, 0.4, 0.3,
0.2, 0.45, 0.35), byrow=TRUE, nrow=3,
dimnames = list(weatherStates, weatherStates))
@denisbr
denisbr / Vagrantfile
Created May 12, 2011 11:29
Puppetmaster / Client vagrantfile
Vagrant::Config.run do |config|
config.vm.define :puppetserver do |puppetserver_config|
puppetserver_config.vm.box = "lucid64_local"
puppetserver_config.vm.host_name = "puppetmaster"
puppetserver_config.vm.forward_port("ssh", 22, 2222, :auto => true)
#puppetserver_config.vm.forward_port("http", 80, 8080)
puppetserver_config.vm.network "192.168.10.10"
# puppetserver_config.vm.boot_mode = :gui
puppetserver_config.vm.provision :shell, :path => "shellprovision/prepuppet.sh"
puppetserver_config.vm.provision :puppet do |puppet|
@terrancesnyder
terrancesnyder / install-selenium-grid-service.bat
Created May 27, 2011 20:42
selenium grid console on windows as service
# create server
cmd /c sc create SeleniumGrid binPath= "cmd /c ant -f \"C:\opt\selenium-grid-1.0.8\build.xml\" launch-hub " DisplayName= "Selenium Grid Server"
# create client
cmd /c sc create SeleniumGridClient binPath= "cmd /c ant -f \"C:\opt\selenium-grid-1.0.8\build.xml\" -Dport=4545 -Denvironment=*chrome launch-remote-control " DisplayName= "Selenium Grid Client"
# This doesn't work, want to create a tc7 server... sigh...
cmd /c sc create Tomcat binPath= "C:\opt\tomcat7\srvany.exe" start= "auto" DisplayName= "Apache Tomcat Server"
# Save this as tomcat-service.reg
@clarkdave
clarkdave / vows-phantom.js
Created November 24, 2011 10:43
Testing with Vows and PhantomJS
var phantom = require('phantom'),
vows = require('vows'),
assert = require('assert');
// nesting tests inside phantom callback so we only
// have to create it once
phantom.create(function(ph) {
var get_page_result = function(url, fn, result) {
ph.createPage(function(page) {
@terrancesnyder
terrancesnyder / gist:4366869
Created December 24, 2012 00:25
Bug with pentaho output servlet
var out = _step_.getTrans().getServletPrintWriter();
out.println("<H1>");
out.println("Hello World!");
out.println("ときょ 東京 コーヒー");
out.println("</H1>");
@abramsm
abramsm / gist:5483928
Created April 29, 2013 19:09
example HLL+ for different p values
for (int p = 10; p < 18; p++)
{
HyperLogLogPlus hyperLogLogPlus = new HyperLogLogPlus(p, 25);
int count = 4200000;
for (int i = 0; i < count; i++)
{
hyperLogLogPlus.offer("i" + i);
}
long estimate = hyperLogLogPlus.cardinality();
double se = count * (1.04 / Math.sqrt(Math.pow(2, p)));

Puppet with Jenkins

Setup Jenkins

With Puppet:

puppet module install rtyler-jenkins

puppet apply -v -e "include jenkins"

@cykl
cykl / HLLMergeBenchmark.java
Created June 2, 2013 18:32
Benchmarks for stream-lib/faster_hll
package bench;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.BenchmarkType;
import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.State;
@eeichinger
eeichinger / ConcordionSpringJunit4ClassRunner.java
Created May 17, 2012 15:56
Spring Test / Concordion integration - integrate Concordion with Spring's test runner
package testsupport;
import org.concordion.api.ResultSummary;
import org.concordion.internal.FixtureRunner;
import org.junit.runner.Description;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.Statement;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@maxsap
maxsap / CustomJwtTokenStore
Last active April 10, 2020 08:55
Spring Security OAuth2 programmatic configuration.
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.commons.lang3.SerializationUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.jwt.JwtHelper;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.common.OAuth2RefreshToken;
import org.springframework.security.oauth2.common.exceptions.InvalidTokenException;