Network emulation
- http://info.iet.unipi.it/~luigi/dummynet/ -
- http://www.linuxfoundation.org/collaborate/workgroups/networking/netem
Articles
| import java.io.FileOutputStream | |
| import java.io.IOException | |
| import java.io.InputStream | |
| import java.io.OutputStream | |
| import javax.sound.sampled.* | |
| import kotlin.concurrent.thread | |
| import kotlin.system.exitProcess | |
| fun main() { | |
| val format = AudioFormat(16000.0f, 16, 1, true, true) |
| import java.io.BufferedInputStream | |
| import java.io.FileInputStream | |
| import javax.sound.sampled.* | |
| // expect a path to a wav file as a first argument | |
| fun main(args: Array<String>) { | |
| val fileInputStream = BufferedInputStream(FileInputStream(args.first())) | |
| val audioInputStream = AudioSystem.getAudioInputStream(fileInputStream) | |
| val clip = AudioSystem.getClip() |
| package shaders | |
| fun convertToObj(model: Md2Model, frameIndex: Int): String { | |
| val result = StringBuilder() | |
| val frame = model.frames[frameIndex] ?: return "" | |
| result.appendLine("mtllib sphere.mtl") | |
| result.appendLine("o testModel") | |
| // v vec3_position | |
| frame.points.forEach { | |
| result.appendLine("v ${it.x * frame.scale[0]} ${it.z * frame.scale[2]} ${it.y * frame.scale[1]}") |
| <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.08"> | |
| <CstmrCdtTrfInitn> | |
| <GrpHdr> | |
| <MsgId>3f93b34c-8b69-4b0c-bcee-d181881cc95</MsgId> | |
| <CreDtTm>2017-03-31T18:51:44.018+03:00</CreDtTm> | |
| <NbOfTxs>39</NbOfTxs> | |
| <CtrlSum>12754007436</CtrlSum> | |
| <InitgPty> | |
| <Id> |
| class JsonValidator extends BuilderSupport { | |
| def root = null | |
| void setParent(Object parent, Object child) { | |
| if (!root) root = parent | |
| parent.children << child | |
| } | |
| void createNode(Object name, Map attributes, Object value) { | |
| return [name: name, value: value, children: []] | |
| } |
| case ItemType.USABLE: | |
| if (item.quantity) { | |
| item.effects*.apply this | |
| item.quantity-- | |
| } | |
| if (!item.quantity) | |
| inventory.remove item | |
| break |
| package org.demoth.aurora.server | |
| import com.jme3.network.* | |
| import org.demoth.aurora.common.* | |
| import org.demoth.aurora.common.messages.TextMessage | |
| import org.demoth.aurora.common.messages.client.* | |
| import org.demoth.aurora.common.messages.server.GameUpdateMessage | |
| import org.demoth.aurora.server.abilities.Ability | |
| import org.demoth.aurora.server.items.* | |
| import org.junit.* |
| class Actor { | |
| private static final ArrayList<ItemSlot> BOTH_HANDS = [MAIN_HAND, OFF_HAND] | |
| private static final ArrayList<ItemSlot> BOTH_RINGS = [RING_RIGHT, RING_LEFT] | |
| // items | |
| Collection<Item> inventory = [] | |
| Map<ItemSlot, Item> equipment = [:] | |
| void useOrEquip(int itemId, ItemSlot targetSlot) { |
| void update(float tpf) { | |
| super.update(tpf) | |
| // lets process a message | |
| ClientMessage mess = messages.poll() | |
| if (mess != null) { | |
| switch (mess.class) { | |
| case ActionRequestMessage: | |
| if (players.get(mess.id).name != null) // if logged in | |
| players.get(mess.id).actions << (mess as ActionRequestMessage) | |
| break |
Network emulation
Articles