Snippet for ~/.bash_profile, adding hostname autocomplete to ssh.
Extracts host hints from both ~/.ssh/config and /etc/hosts.
function _completeSSHHosts {
COMPREPLY=()
local currentWord=${COMP_WORDS[COMP_CWORD]}| package bill.boottest; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import org.springframework.boot.CommandLineRunner; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| import org.springframework.cloud.aws.messaging.listener.annotation.SqsListener; | |
| import com.fasterxml.jackson.annotation.JsonCreator; |
| #!/bin/bash | |
| function main() | |
| { | |
| monitor_from_file $* | |
| } | |
| function monitor_vpn_ip_port() | |
| { | |
| local CONN_NAME=$1 |
| _complete_ssh_hosts () | |
| { | |
| COMPREPLY=() | |
| cur="${COMP_WORDS[COMP_CWORD]}" | |
| comp_ssh_hosts=`cat ~/.ssh/known_hosts | \ | |
| cut -f 1 -d ' ' | \ | |
| sed -e s/,.*//g | \ | |
| grep -v ^# | \ | |
| uniq | \ | |
| grep -v "\[" ; |
| #Create Group | |
| # groupadd tomcat | |
| # useradd -g tomcat -d /usrlocal/tomcat8 tomcat | |
| # usermod -G www-data tomcat | |
| # chown tomcat:tomcat /usrlocal/tomcat8 -R | |
| # vim /etc/init.d/tomcat | |
| #!/bin/sh |
| Server Tasks | |
| 1. Change root password | |
| 2. Change ssh port (assume to be 4444) | |
| nano /etc/ssh/sshd_config(change port to between 1025 and 65536) | |
| PermitRootLogin no | |
| service ssh restart | |
| ssh -p 4444 demo@SERVER_IP_ADDRESS |
| #! /usr/bin/env python | |
| ''' | |
| This is more of a personal reference as I use json very often. | |
| The httplib2 examples are VERY good, and you should refer to them: | |
| http://code.google.com/p/httplib2/wiki/Examples | |
| ''' | |
| from httplib2 import Http | |
| try: |
| import base64 | |
| import os | |
| from tastypie.fields import FileField | |
| from django.core.files.uploadedfile import SimpleUploadedFile | |
| class Base64FileField(FileField): | |
| """ | |
| A django-tastypie field for handling file-uploads through raw post data. | |
| It uses base64 for en-/decoding the contents of the file. | |
| Usage: |