Skip to content

Instantly share code, notes, and snippets.

@rtomaszewski
rtomaszewski / example_paramiko_with_tty.py
Created Aug 19, 2012
example paramiko script with interactive terminal
View example_paramiko_with_tty.py
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 / ssh_example.py
Last active Jul 7, 2019
Example script written in python that executes remotely commands over ssh
View ssh_example.py
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 :
@rtomaszewski
rtomaszewski / example_paramiko_notty.py
Created Aug 19, 2012
example paramiko script that tries to run an interactive command that needs a terminal
View example_paramiko_notty.py
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()
View gist:8c7abdf38d0ba2e11ce870dbbff50e44
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 Aug 28, 2012
example how to use paramiko to implement a bastion host pattern for command execution
View bastion.py
#!/usr/bin/env python
import re
import time
import datetime
import paramiko
import traceback
DEBUG = 1
@rtomaszewski
rtomaszewski / 0_reuse_code.js
Created Jan 11, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View Exercise-2-and-3
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.
View instalation
aptitude install git
aptitude install gcc
aptitude install python-dev
aptitude install python-pip
pip install pymongo
pip install bottle
View mongo_shell
# 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