Commit 5bb1eccb authored by Bstrdsmkr's avatar Bstrdsmkr
Browse files

Update code for the new format

parent a13c13ad
from bottle import Bottle, request, run
app = Bottle()
@app.route('/say_hello', method='POST')
def hello():
name = request.forms['name']
return "Hello {}!".format(name)
run(app, host='localhost', port=8080)
import requests
from threading import Thread
from bottle import Bottle, request, run
app = Bottle()
@app.route('/new_registration', method='POST')
def new_registration():
nick = request.forms['nick']
print "{} has joined the channel".format(nick)
@app.route('/new_msg', method='POST')
def new_msg():
##########################################################
# This will get called every time the server sends you a
# new message
# Get the 'nick' and 'msg' parameters and print out a
# formatted string
##########################################################
def poll_user_input(nick):
while True:
msg = raw_input("Send message: ")
payload = {'msg': msg, 'nick': nick}
requests.post('http://testpuppet.ornl.gov/chat', data=payload)
##############################################################
# 1. Use your code from Challenge #1 to register to the server
# 2. Set the 'my_nick' variable to the uid you registered with
##############################################################
input_loop = Thread(target=poll_user_input, args=(my_nick,))
input_loop.start()
run(app, host='localhost', port=80)
import paramiko
from getpass import getpass
password = getpass("Enter password: ")
names = ["anthony", "brian", "caleb", "dale", "davida", "davids", "janice", "jason", "jim", "john", "ken",
"ketan", "matt", "michael", "nathan", "patti", "pete", "rich", "robert", "steve", "zach"]
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
vimrc = '''
filetype off
call pathogen#infect()
call pathogen#helptags()
" let g:flake8_show_quickfix=0
let g:flake8_show_in_gutter=1
let g:flake8_show_in_file=1
autocmd BufWritePost *.py call Flake8()
map <leader>j :RopeGotoDefinition<CR>
map <leader>r :RopeRename<CR>
nmap <leader>a <Esc>:Ack!
au FileType python set omnifunc=pythoncomplete#Complete
let g:SuperTabDefaultCompletionType = "context"
set completeopt=menuone,longest,preview
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=236
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=240
set foldmethod=indent
set foldlevel=99
set number
set paste
syntax on " syntax highlighting
colorscheme monokai
filetype on " try to detect filetypes
filetype plugin indent on " enable loading indent file for filetype
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
'''
for user in names:
vm_name = "{}-cades.ornl.gov".format(user)
print 'Connecting to {}'.format(vm_name)
ssh.connect(vm_name, username='root', password=password)
sftp = ssh.open_sftp()
with sftp.open("/etc/skel/.vimrc", "w") as remtote_vimrc:
remtote_vimrc.write(vimrc)
sftp.close()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment