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
for(int q=start;q<n+start;q++) | |
{ | |
IntegerVectorIndividual i = (IntegerVectorIndividual)inds[q]; | |
for(int x=0;x<i.genome.length;x++) | |
if (state.random[thread].nextBoolean(species.mutationProbability)) | |
i.genome[x] = -i.genome[x]; | |
// it's a "new" individual, so it's no longer been evaluated | |
i.evaluated=false; | |
} | |
return n; |
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
package com.stackmob.posttest.server | |
import java.net.InetSocketAddress | |
import com.twitter.finagle.builder.ServerBuilder | |
import com.twitter.finagle.http.Http | |
import com.stackmob.common.logging.LoggingSugar | |
import scalamachine.finagle.{FinagleWebmachineV3, FinagleWebmachineService} | |
import scalamachine.core.dispatch.Route._ | |
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
> a <- array(1:20, dim=c(4:5)) | |
> a | |
[,1] [,2] [,3] [,4] [,5] | |
[1,] 1 5 9 13 17 | |
[2,] 2 6 10 14 18 | |
[3,] 3 7 11 15 19 | |
[4,] 4 8 12 16 20 | |
> a[1,] | |
[1] 1 5 9 13 17 | |
> a[,2] |
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
final CountDownLatch localLatch = latchOne(); | |
final MultiThreadAsserter localAsserter = new MultiThreadAsserter(); | |
StackMobObjectOnServer<UserOnServer> user = doLoginLogout(StackMob.OAuthVersion.Two, false); | |
List<HashMap<String, String>> chores = new ArrayList<HashMap<String, String>>(); | |
HashMap<String, String> todo1 = new HashMap<String, String>(); | |
todo1.put("action", "related object 1"); | |
HashMap<String, String> todo2 = new HashMap<String, String>(); |
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 RentalCar | |
attr_accessor :miles_travelled | |
def check_maintenance | |
if @miles_travelled > 60000 | |
puts "Give it a tuneup!" | |
end | |
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
# See http://www.zerocater.com/challenge/#mathy-challenge for details of what | |
# this code does | |
# | |
# The approach I took was to Google 'primal sums' and get most of the solution | |
# directly: | |
# | |
# http://oeis.org/A007506 | |
# | |
# I also use pre-computed lists of primes to avoid having to implement a sieve | |
# in order to get lists of primes. |
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
# resulting image: http://i.imgur.com/E5CsReh.png | |
# create a 1680x1050 image using Arial, 12pt | |
set terminal pngcairo enhanced font "arial,12" fontscale 1.0 size 1680, 1050 | |
# write to the file 'multiplot_test.png' | |
set output 'multiplot_test.png' | |
# turn key off since we will be plotting many different |
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
library(ggplot2) | |
eurusd <- read.table("/home/warren/Downloads/EURUSD_Candlestick_1_D_BID_01.03.2007-16.03.2013.csv", sep=",", header=T) | |
eurusd$Time <- as.Date(eurusd$Time, "%d.%m.%Y %H:00:00.000") | |
long_trades = read.table(textConnection( | |
"Open, Close | |
2009-02-02, 2009-02-10 | |
2009-04-05, 2009-06-07 | |
2013-01-01, 2013-01-25"), sep=',', |
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 | |
IFS=" | |
" | |
echo | |
for FRAME in \ | |
"B :^)" \ | |
" B :^)" \ | |
" B :^)" \ | |
" B :^)" \ |
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/sh | |
# rename pre-commit.sample in the hooks directory to pre-commit and replace its content with this | |
set_traces=`git grep "pdb.set_trace()"` | |
if [ ! -z "$set_traces" ] ; then | |
echo "You have pdb.set_trace() in your code! Commit aborted!" | |
echo $set_traces | |
exit 1 |