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 java.util.List; | |
import java.util.LinkedList; | |
public class Permute { | |
public static void main(String[] args) { | |
for(String s : permute("abcd")) | |
System.out.println(s); | |
} | |
public static List<String> permute(String s) { |
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 | |
WOWPATH="/home/joshua/.wine/drive_c/Program Files (x86)/World of Warcraft" | |
cd "$WOWPATH" | |
if [ "$1" == "launcher" ]; then | |
WINEDEBUG=-all wine "World of Warcraft Launcher.exe" | |
elif [ "$1" == "kill" ]; then | |
wineserver -k |
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 | |
################################################## | |
# for generating your root CA private key and cert | |
################################################## | |
ca_name="jmhca" | |
ca_key_bits="4096" | |
ca_cert_expire_days="365" |
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
Instead of this... | |
thinger: blah blah at x: 1, y: 1, z: 1 | |
do this: | |
thinger: | |
msg: blah blah | |
x: 1 | |
y: 1 |
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 SomePlugin extends JavaPlugin { | |
private Map<String, Order> orders; | |
... | |
public void onEnable() { | |
//you'll need to remember to load the config from disk | |
//something like | |
//this.orders = getConfig().getMap("Amazon.Players"); | |
this.orders = new HashMap<String, Order>; |
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
#The Configuration For Amazon!# | |
#This Config Will Contain Orders & More# | |
Amazon: | |
Players: | |
danderion: | |
item: DIAMOND_SWORD | |
count: 1 | |
everdras: | |
item: DIAMOND | |
count: 64 |
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
/* | |
* Copyright (C) 2013 everdras@gmail.com | |
* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
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 java.awt.Color; | |
import java.awt.Graphics; | |
import javax.swing.JFrame; | |
import javax.swing.SwingWorker; | |
public class MuhJFrame extends JFrame { | |
private SwingWorker gameLooper; | |
private boolean stop; | |
private int seconds; |
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
client connects to server | |
<authentication happens> | |
client writes a RemoteAction enum to signal what it wants to do (ADD_PLAYER, REMOVE_PLAYER, etc) | |
server reads enum, uses a big switch-case to direct flow to appropriate method | |
in the appropriate method, server reads in "arguments" for action one by one, as client sends them | |
server executes the action once it has all its input | |
server communicates back exit status |
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
private void deleteTown(ObjectOutputStream oos, ObjectInputStream ois) throws IOException, ClassNotFoundException { | |
//receive arguments over socket | |
final String townName = (String) ois.readObject(); | |
final FutureBoolean result = new FutureBoolean(); | |
final Object callback = this; | |
//prepare a Runnable object to delete the town from the server's main thread | |
Runnable r = new Runnable() { | |
@Override |
NewerOlder