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 au.com.bytecode.opencsv.CSVReader; | |
//import au.com.bytecode.opencsv.CSVWriter; | |
String encoding= "UTF-8"; | |
Reader in = new InputStreamReader(new FileInputStream("/path/to/csvfile.csv"), encoding); | |
ByteArrayOutputStream ret = new ByteArrayOutputStream(); | |
Writer out = new OutputStreamWriter(ret, encoding); | |
CSVWriter writer = new CSVWriter(out, ',', '"', '"', "\n"); | |
CSVReader reader = new CSVReader(in); |
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
byte[] buf= {}; | |
Connection conn = DriverManager.getConnection(JDBC_URL, JDBC_USER, JDBC_PASS); | |
//conn.setAutoCommit(false); | |
Statement stmt = conn.createStatement(); | |
String sql = "LOAD DATA LOCAL INFILE '' INTO TABLE thetable" | |
+ " FIELDS TERMINATED BY ',' ENCLOSED BY '\"' ESCAPED BY '\"'" | |
+ " LINES TERMINATED BY '\n'"; | |
InputStream is = new ByteArrayInputStream(buf); | |
((com.mysql.jdbc.Statement) stmt).setLocalInfileInputStream(is); | |
stmt.execute(sql); |
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
from email.parser import Parser | |
from email.header import decode_header | |
fp = open("/path/to/mail.eml", "rb") | |
parser = Parser() | |
message = parser.parse(fp) | |
fp.close() | |
strs = [] | |
for pair in decode_header(message['Subject']): |
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/bash | |
NAME=`smbutil statshares -a | awk 'BEGIN{F=0}/^nasne_home/{F=1}F==1 && /SERVER_NAME/ {print $2;exit}'` | |
IPADDR=`smbutil lookup ${NAME} | awk '/^IP address of /{print $NF}'` | |
URL="http://${IPADDR}:64210/status/HDDInfoGet?id=0" | |
curl -s ${URL} \ | |
| awk '{gsub("[,}]", "\n");print $0}' \ | |
| awk '/usedVolumeSize/{u=$NF}/totalVolumeSize/{t=$NF}END{printf "%.2f%%\n", u/t*100}' |
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.io.IOException; | |
import java.io.StringReader; | |
import java.util.ArrayList; | |
import java.util.Hashtable; | |
import javax.xml.parsers.DocumentBuilder; | |
import javax.xml.parsers.DocumentBuilderFactory; | |
import javax.xml.xpath.XPath; | |
import javax.xml.xpath.XPathConstants; | |
import javax.xml.xpath.XPathExpressionException; |
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.io.IOException; | |
import java.io.StringReader; | |
import javax.xml.parsers.DocumentBuilderFactory; | |
import javax.xml.parsers.ParserConfigurationException; | |
import javax.xml.xpath.XPathConstants; | |
import javax.xml.xpath.XPathExpressionException; | |
import javax.xml.xpath.XPathFactory; | |
import org.w3c.dom.Document; |
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.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.PrintWriter; | |
import java.net.ServerSocket; | |
import java.net.Socket; | |
import java.util.ArrayList; | |
public class Server extends Thread { | |
private static final int PORT = 8080; |
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
#! /usr/bin/env python | |
#encoding: utf-8 | |
import numpy as np | |
import chainer.functions as F | |
from chainer import FunctionSet, Variable, optimizers | |
model= FunctionSet( | |
l1 = F.Linear(2, 2), | |
l2 = F.Linear(2, 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
#! /usr/bin/env python | |
#encoding: utf-8 | |
import numpy as np | |
import chainer.functions as F | |
from chainer import FunctionSet, Variable, optimizers | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
fig = plt.figure() | |
ax = fig.add_subplot(111, aspect='equal') |
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
#! /usr/bin/env python | |
#encoding: utf-8 | |
import numpy as np | |
import chainer.functions as F | |
from chainer import FunctionSet, Variable, optimizers | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
fig = plt.figure() | |
ims = [] |