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 os | |
import pyrax | |
conf = os.path.expanduser("rackspace_cloud_credentials.txt") | |
#pyrax.set_credential_file(conf, "LON") | |
pyrax.set_credential_file(conf) | |
cs = pyrax.cloudservers | |
servers = cs.servers.list() | |
print ("cloud server under your account:") |
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
; This program adjust scroling of the mouse wheel on windows. | |
GLOBAL CONST $SPI_SETWHEELSCROLLLINES = 105 | |
$SPIF_UPDATEINIFILE = 0x1 | |
$SPIF_SENDWININICHANGE = 0x2 | |
$SPIF_SENDCHANGE = $SPIF_SENDWININICHANGE | |
$WHEEL_PAGESCROLL = 4294967295 ; Use this, if you want scroll one Screen at a time |
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
def myfunc(message): | |
""" | |
This is external function | |
@param message: this is string that is going to be printed | |
@return: none | |
""" | |
print("myfunc: %s" % message) |
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 | |
import re | |
import time | |
import datetime | |
import paramiko | |
import traceback | |
DEBUG = 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 paramiko | |
import time | |
import re | |
bastion_ip='ip' | |
bastion_pass='pass' | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy( paramiko.AutoAddPolicy() ) | |
ssh.connect(bastion_ip, username='root', password=bastion_pass) |
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 paramiko | |
bastion_ip='ip' # you have to edit and provide valid IP address | |
bastion_pass='pass' # you have to edit it and provide valid password | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy( paramiko.AutoAddPolicy() ) | |
ssh.connect(bastion_ip, username='root', password=bastion_pass) | |
chan = ssh.invoke_shell() |
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 | |
iptables=$(iptables -nL) | |
ret=no | |
if echo $iptables | grep -q 'Chain INPUT .policy DROP.' ; then | |
if echo $iptables | grep -q 'Chain FORWARD .policy DROP.' ; then | |
if echo $iptables | grep -q 'Chain OUTPUT .policy ACCEPT.' ; then | |
if echo $iptables | grep -q 'Chain RS-RackConnect-INBOUND' ; then | |
ret=yes |
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 paramiko | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy( paramiko.AutoAddPolicy() ) | |
ssh.connect('5.79.4.10', username='root', password='7raW6nS6Krttest') | |
stdin, stdout, stderr = ssh.exec_command('echo text on stdout stream; echo text on stderror stream 1>&2') | |
print("reading outputs from the remote command") | |
for l in stdout : |
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 JavaExample { | |
// with the next line commented the code is erroring out when we try to compile it | |
//public int number; | |
public JavaExample (int _number) { | |
number=_number; | |
} | |
public void show() { | |
System.out.println("[test " + number + "] list=%s"); |
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
class Test1InstanceVariable: | |
mylist=[] | |
def __init__(self, number): | |
self.number= number | |
def add(self, i): | |
self.mylist.append(i) | |
def show(self): |