Skip to content

Instantly share code, notes, and snippets.

View ryanmr's full-sized avatar

Ryan Rampersad ryanmr

View GitHub Profile
ryan@server2:~/Go/src/github.com/ryanmr/wargame-go$ $GOPATH/bin/wargame-go 
WarGame Go
4. done | et = 10s; g = 128691; s = 12.81850 g/ms; t = 875; 3;  
---

Samples: 875 collected
Mean: 12.82404
Standard Deviation: 0.10184
Coefficient of Variation: 0.00794
func get_median(samples []float64) float64 {
sort.Float64s(samples)
l := len(samples)
r := 0.0
if (l % 2 == 1) {
r = samples[int(math.Floor(float64(l/2)))]
} else {
s1 := l/2
s2 := s1 + 1
r = float64((samples[s1] + samples[s2])/2.0)
package main
import (
"golang.org/x/tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
count := map[string]int{}
@ryanmr
ryanmr / prog.go
Last active December 28, 2015 06:56
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) (float64, int) {
z, l, d := 1.0, 1.0, 1.0
i := 0
import java.io.*;
import java.net.*;
class NetworkApp {
public static int payload = 10000000;
// public static int payload = 1000000;
// public static int payload = 100000;
public static int expected_rounds = 10;

To compile:

javac NetworkApp.java

To run:

There are four CLI flags: 1: transport mode: tcp or udp 2: application mode: s or c (for client or server)

/*
create_graph
1. sets basic defaults on all nodes
2. finds the root nodes and sets them to READY
3. finds the number of parents of each node
*/
void create_graph(node_t **nodes, int node_count) {
// initially set all to inelgible
int g = 0;

Source Modified

Mostly C files

  • backend/executor/Makefile

  • backend/executor/execProcnode.c

  • backend/executor/nodeIgnore.c

  • backend/executor/nodeIgnore.h

  • backend/nodes/copyfuncs.c

; income-tax
; arguments: 3
; income - the income on which to be taxed
; algorithm:
; first 35k @ 15%
; second 65k @ 25%
; third 10k @ 35%
; state-first 50k @ 5%
(define (income-tax income)
{
"id": null,
"title": "sometitle",
"subtitle": "somesubtitle",
"number": "4124",
"series_id": 3,
"state": "draft",
"hidden": false,
"nsfw": false,
"created_at": null,