Skip to content

Instantly share code, notes, and snippets.

@seungjin
seungjin / journal_parser.py
Created August 27, 2010 17:21
mysql table exported xml parse with python
# journal parser
"""
<row>
<id>2183</id>
<date>2010-08-27</date>
<time>09:04:12</time>
<timezone>MST</timezone>
<tag>Scratch</tag>
<html>
<head>
<style type="text/css">
#targetimg {
background-image:url('http://c.seungjin.net/picture/7');
width: 800px;
height: 600px;
position: static;
}
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
<script>
$(document).ready(function(){
ws = new WebSocket("ws://localhost:8080/");
ws.onopen = function() { console.log("open"); };
ws.onmessage = function(evt) {
<html>
<head>
<!-- http://faye.jcoglan.com/browser.html -->
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'>
</script>
<script type="text/javascript" src="http://localhost:8000/faye.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var client = new Faye.Client("http://localhost:8000/faye");
var subscription = client.subscribe('/email/new', function(msg){alert(msg.text);});
<html>
<head>
<!-- http://faye.jcoglan.com/browser.html -->
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'>
</script>
<script type="text/javascript" src="/faye.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var client = new Faye.Client("/faye");
var subscription = client.subscribe('/new_log', function(msg){ $("#msg").append(msg.text+"<br/>"); });
from twisted.conch import error
from twisted.conch.ssh import transport, connection, keys, userauth, channel, common
from twisted.internet import defer, protocol, reactor
class ClientCommandTransport(transport.SSHClientTransport):
def __init__(self, username, password, command):
self.username = username
self.password = password
self.command = command
<html>
<head>
<script type="text/javascript">
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
} catch (e) {
alert("Permission UniversalBrowserRead denied.");
}
try {
<html>
<head>
</head>
<body>
<h1>reading file from arg</h1>
browser try to read "/Users/seungjin/Desktop/test"<br/>view the javascript src.<br/>
<code id="console1">...console1...</code>
(comment
this source is from http://www.learningclojure.com/2010/09/clojure-13-first-impression.html
I will try this cljure src later when I get free time.)
(import '(javax.swing JFrame JPanel )
'(java.awt Color Graphics Graphics2D))
(defn ^:static draw-tree [ #^Graphics g2d ^double angle ^double x ^double y ^double length ^double branch-angle ^long depth]
(if (> depth 0)
(let [new-x (- x (* length (Math/sin (Math/toRadians angle))))
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
canvas {border:1px solid #444; }
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script></head>
<body>
<canvas id="cv" width="1000" height="800"></canvas>
</body>