Skip to content

Instantly share code, notes, and snippets.

@rtomaszewski
rtomaszewski / example_paramiko_with_tty.py
Created August 19, 2012 19:49
example paramiko script with interactive terminal
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)
@rtomaszewski
rtomaszewski / example_paramiko_notty.py
Created August 19, 2012 19:05
example paramiko script that tries to run an interactive command that needs a terminal
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()
@rtomaszewski
rtomaszewski / ssh_example.py
Last active July 7, 2019 11:13
Example script written in python that executes remotely commands over ssh
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 :
root@debian:~# cat rado.los
WARNING:
Some git sub-modules are out of date or modified, please consider runnning:
git submodule sync --recursive
git submodule update --init --recursive
You can ignore this warning if you are not compiling any ChibiOS keyboards,
or if you have modified the ChibiOS libraries yourself.
Making ergodox/ez with keymap rado
@rtomaszewski
rtomaszewski / bastion.py
Created August 28, 2012 23:43
example how to use paramiko to implement a bastion host pattern for command execution
#!/usr/bin/env python
import re
import time
import datetime
import paramiko
import traceback
DEBUG = 1
@rtomaszewski
rtomaszewski / README.md
Created January 27, 2016 15:10 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@rtomaszewski
rtomaszewski / 0_reuse_code.js
Created January 11, 2014 00:00
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
cd ~/mongo-course/week1/homework#
# python hw1-2.21394489c9ad.py
The answer to Homework One, Problem 2 is 1815
# python hw1-3.e594fc84d4ac.py
Bottle v0.11.6 server starting up (using WSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.
# extract the hw1 archive file
# change to the directory
$ ls
root@mongo2:~/hw1# ls -la
total 24
drwxrwxr-x 3 root root 4096 Dec 18 23:57 .
drwxr-xr-x 11 root root 4096 Dec 18 23:57 ..
drwxr-xr-x 3 root root 4096 Feb 12 2013 dump
-rw-r--r-- 1 root root 598 Mar 27 2013 hw1-2.py
-rw-r--r-- 1 root root 2584 Dec 18 23:51 hw1-2.py.html
aptitude install git
aptitude install gcc
aptitude install python-dev
aptitude install python-pip
pip install pymongo
pip install bottle