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 Control.Applicative hiding ((<|>),many) | |
import Control.Monad | |
import Control.Monad.State | |
import Text.Parsec | |
import Text.Parsec.String | |
import Data.Functor.Identity | |
import Safe (headMay) | |
data Network = Network { networkCell :: String | |
, networkIP :: String |
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
(defn create-session [hostname username password] | |
(doto (. (new JSch) getSession username hostname 22) | |
(.setPassword password) | |
(.setConfig "StrictHostKeyChecking" "no") | |
(.connect) | |
(.setServerAliveInterval 1000) | |
(.setServerAliveCountMax 30))) | |
(defn sleep [seconds] | |
(. Thread (sleep (* 1000 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
// Somewhere earlier: | |
session = jsch.getSession(cvlUsername, cvlHost, 22); | |
session.setPassword(cvlPassword); | |
session.setConfig("StrictHostKeyChecking", "no"); | |
session.connect(); | |
session.setServerAliveInterval(1000); | |
session.setServerAliveCountMax(30); | |
commandOutput = sendCommand(session, "uptime", true, launcherLogWindowTextArea); |
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
""" | |
Typical failure, about 70% of the time on a Debian Squeeze 32bit VM (in VirtualBox, with Debian Squeeze 64bit host OS). | |
Exception in thread Thread-1: | |
Traceback (most recent call last): | |
File "/opt/sw/32bit/debian/python/2.7.3/lib/python2.7/threading.py", line 551, in __bootstrap_inner | |
self.run() | |
File "blammo.py", line 49, in run | |
myappMainFrame.loginThread.boo = 42 | |
AttributeError: 'MyAppMainFrame' object has no attribute 'loginThread' |
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
# Debugging for a threading/ui problem. Sometimes get stuck in an infinite | |
# loop just after the line "logger.debug('AAA 6')" | |
import logging | |
from StringIO import StringIO | |
# The top-level logging object. We call this with things like | |
# logger.debug(...), logger.error(...), etc. |
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
# Debugging for a threading/ui problem. Sometimes get stuck in an infinite | |
# loop just after the line "logger.debug('AAA 6')" | |
import logging | |
from StringIO import StringIO | |
# The top-level logging object. We call this with things like | |
# logger.debug(...), logger.error(...), etc. |
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
# Debugging for a threading/ui problem. Sometimes get stuck in an infinite | |
# loop just after the line "logger.debug('AAA 6')" | |
import logging | |
from StringIO import StringIO | |
# The top-level logging object. We call this with things like | |
# logger.debug(...), logger.error(...), etc. |
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 | |
set -x | |
set -e | |
module load python/2.7.3 | |
mkdir -p /opt/src | |
cd /opt/src |
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
-- Fiddling around with STM and shell processes. | |
-- Carlo Hamalainen <[email protected]> | |
import Control.Concurrent | |
import Control.Concurrent.MVar | |
import Control.Concurrent.STM | |
import Control.Concurrent.STM.TChan | |
import Control.Exception |
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
""" | |
From the man page for ssh: | |
-f Requests ssh to go to background just before command execution. This is useful if ssh is going to ask | |
for passwords or passphrases, but the user wants it in the background. This implies -n. The recommended way | |
to start X11 programs at a remote site is with something like ssh -f host xterm. | |
If the ExitOnForwardFailure configuration option is set to “yes”, then a client started with -f will wait | |
for all remote port forwards to be successfully established before placing itself in the background. |