This file contains hidden or 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 Challenge { | |
public static void main(String[] args) throws Exception { | |
int r=0; | |
for(String t : ("+"+Input.read().replaceAll("plus\\s+","+").replaceAll("minus\\s+","-")).split(" ")) | |
r+=(t.charAt(0)=='+'?1:-1)*(java.util.Arrays.asList("on","tw","th","fo","fi","si","se","ei","ni").indexOf(t.substring(1,2))+1); | |
Output.write(""+r); | |
} | |
} |
This file contains hidden or 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 Problem1 { | |
static enum Oper { | |
PLUS, | |
MINUS | |
} | |
public static void main(String[] args) { | |
Oper lastOp = null; | |
Integer lastNum = null; | |
Integer res = null; | |
for (String s : Input.read().split(" ")) { |
This file contains hidden or 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.*; | |
public class Challenge { | |
public static void main(String[] args) throws Exception { | |
// Build map. | |
Map<String,Set<String>> graph = new HashMap<String,Set<String>>(); | |
for (String rel : Input.read().split("\\,")) { | |
String[] toks = rel.split("\\-"); | |
Set<String> friends = graph.containsKey(toks[0]) ? graph.get(toks[0]) : new HashSet<String>(); | |
graph.put(toks[0], friends); | |
friends.add(toks[1]); |
This file contains hidden or 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.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import javax.swing.Timer; | |
/** | |
* Runs the last surviving task published after a specified delay. | |
* | |
* @author STaylor |
This file contains hidden or 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 | |
service iptables stop | |
iptables -F | |
iptables -P INPUT ACCEPT | |
iptables -P OUTPUT ACCEPT | |
iptables -P FORWARD DROP | |
# Allow all loopback | |
iptables -A INPUT -i lo -j ACCEPT |
This file contains hidden or 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 | |
IPADDR=`wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'` | |
NIC=`ip addr show | grep $IPADDR | awk '{ print $(NF) }'` | |
# Rest of your script here |
This file contains hidden or 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 | |
# PostgreSQL user that owns the schema (i.e. executes the deployment DDL). Change as needed. | |
DBSCHEMA_OWNER='app_owner' | |
DBSCHEMA_OWNER_PW='app_owner' | |
# PostgreSQL user that your web app uses to connect to the database (i.e. executes queries and DML). Change as needed. | |
DBSCHEMA_USER='app_user' | |
DBSCHEMA_USER_PW='app_user' |
This file contains hidden or 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 | |
# Set time to Adelaide. | |
echo "ZONE=\"Australia/Adelaide\"" > /etc/sysconfig/clock | |
/bin/cp /usr/share/zoneinfo/Australia/Adelaide /etc/localtime |
This file contains hidden or 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
function StreamingTokenizer(delimiter, callback) { | |
this.delimiter = delimiter; | |
this.callback = callback; | |
this.pendingText = ''; | |
this.open = true; | |
} | |
StreamingTokenizer.prototype = { | |
add: function(text) { | |
if (!this.open) { |
This file contains hidden or 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
/** | |
* Process an array of data synchronously. | |
* | |
* @param data An array of data. | |
* @param processData A function that processes an item of data. | |
* Signature: function(item, i, callback), where {@code item} is the i'th item, | |
* {@code i} is the loop index value and {@code calback} is the | |
* parameterless function to call on completion of processing an item. | |
*/ | |
function doSynchronousLoop(data, processData, done) { |
OlderNewer