Skip to content

Instantly share code, notes, and snippets.

View nazt's full-sized avatar

Nat nazt

  • Chiang Mai Maker Club
  • Chiang Mai
  • X @nazt
View GitHub Profile
file= new File('TIME.ALL')
stopwordsFile=new File('stopwords.txt')
/*stopwords=[]
stopwordsFile.eachLine { stopwords << it.toString().toUpperCase() }
var myIcon = new GIcon();
myIcon.image = 'markers/image.png';
myIcon.printImage = 'markers/printImage.gif';
myIcon.mozPrintImage = 'markers/mozPrintImage.gif';
myIcon.iconSize = new GSize(64,64);
myIcon.shadow = 'markers/shadow.png';
myIcon.transparent = 'markers/transparent.png';
myIcon.shadowSize = new GSize(96,64);
myIcon.printShadow = 'markers/printShadow.gif';
myIcon.iconAnchor = new GPoint(32,64);
// HelloServer.java
import java.io.*;
import java.net.*;
class HelloServer {
public static void main(String args[]) throws Exception {
ServerSocket ss = new ServerSocket(12345);
System.out.println("Server is created.");
Socket s = ss.accept();
PrintStream op = new PrintStream(s.getOutputStream());
op.println("Hello! how do you do?");
// HelloServer.java
import java.io.*;
import java.net.*;
class HelloServer {
public static void main(String args[]) throws Exception {
ServerSocket ss = new ServerSocket(12345);
System.out.println("Server is created.");
Socket s = ss.accept();
PrintStream op = new PrintStream(s.getOutputStream());
op.println("Hello! how do you do?");
def text = "Hello from Groovy!"
def page = new XmlSlurper(new SAXParser()).parse('http://kanchanapisek.or.th/kp6/GENERAL/encyclopedia/saranugrom.htm')
def data= page.depthFirst().grep{ it.name() == 'A' && [email protected]().endsWith('.htm') }.'@href'
def Test()
{
data.each{ println it}
}
class DFS {
def visitedNodeCounter = 0
def visitor = {
visitedNodeCounter++
}
def visit(node) {
node.acceptVisitor visitor
node.children.each { visit(it) }
import groovyx.net.http.*;
def getRemoteFile = {
try {
def http = new HTTPBuilder( params.url)
http.request(Method.GET,ContentType.TEXT) { req ->
headers.'User-Agent' = 'Mozilla/5.0'
response.success = { resp, reader ->
println "My response handler got response: ${resp.statusLine}"
println "Response length: ${resp.headers.'Content-Length'}"
import java.io.*;
import java.net.*;
class TCPClient {
public static void main(String argv[]) throws Exception
{
String sentence;
String modifiedSentence;
Integer i=1;
while(true)
package NAzT
class GMapsGeoCoder {
def Query="Thammasat"
def url
def jsonObj
void setQuery(input)
{
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package NAzT;
import java.util.ArrayList;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;