Compare commits
	
		
			2 Commits
		
	
	
		
			a6905b9489
			...
			c2c0a11402
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					c2c0a11402 | ||
| 
						 | 
					268ad94470 | 
@@ -1,5 +1,5 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
function basedir() {
 | 
			
		||||
  echo $( cd $(dirname $0) && pwd )
 | 
			
		||||
  (cd "$(dirname \"$-2\")" && pwd)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,19 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
note () {
 | 
			
		||||
note() {
 | 
			
		||||
    # if file doesn't exist, create it
 | 
			
		||||
    if [[ ! -f $HOME/.notes ]]; then
 | 
			
		||||
        touch $HOME/.notes
 | 
			
		||||
        touch "$HOME"/.notes
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [[ $# -eq 0 ]]; then
 | 
			
		||||
        # no arguments, print file
 | 
			
		||||
        cat $HOME/.notes
 | 
			
		||||
        cat "$HOME"/.notes
 | 
			
		||||
    elif [[ "$1" == "-c" ]]; then
 | 
			
		||||
        # clear file
 | 
			
		||||
        echo "" > $HOME/.notes
 | 
			
		||||
        echo "" >"$HOME"/.notes
 | 
			
		||||
    else
 | 
			
		||||
        # add all arguments to file
 | 
			
		||||
        echo "$@" >> $HOME/.notes
 | 
			
		||||
        echo "$@" >>"$HOME"/.notes
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,8 @@
 | 
			
		||||
 | 
			
		||||
encpasswd() {
 | 
			
		||||
        local password_clear=$1
 | 
			
		||||
        local password_md5hash=$(openssl passwd -1 $password_clear)
 | 
			
		||||
        local password_sha1=$(echo -n $password_clear | openssl dgst -sha1)
 | 
			
		||||
        local password_md5hash=$(openssl passwd -1 "$password_clear")
 | 
			
		||||
        local password_sha1=$(echo -n "$password_clear" | openssl dgst -sha1)
 | 
			
		||||
        echo "Password : $password_clear"
 | 
			
		||||
        echo "MD5HASH  : $password_md5hash"
 | 
			
		||||
        echo "SHA1  : $password_sha1"
 | 
			
		||||
@@ -12,8 +12,8 @@ encpasswd() {
 | 
			
		||||
genpasswd() {
 | 
			
		||||
        local l=$1
 | 
			
		||||
        [ "$l" == "" ] && l=12
 | 
			
		||||
      	local password_clear=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs)
 | 
			
		||||
        local password_md5hash=$(openssl passwd -1 $password_clear)
 | 
			
		||||
        local password_clear=$(tr -dc A-Za-z0-9_ </dev/urandom | head -c "${l}" | xargs)
 | 
			
		||||
        local password_md5hash=$(openssl passwd -1 "$password_clear")
 | 
			
		||||
        local password_sha1=$(echo -n "$password_clear" | openssl dgst -sha1)
 | 
			
		||||
        local password_base64=$(echo -n "$password_clear" | base64)
 | 
			
		||||
        echo "Password : $password_clear"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,12 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
function ssh_clean_known_hosts ()
 | 
			
		||||
{
 | 
			
		||||
	if [ -z "$1" ]
 | 
			
		||||
	then
 | 
			
		||||
function ssh_clean_known_hosts() {
 | 
			
		||||
	if [ -z "$1" ]; then
 | 
			
		||||
		echo "No arguments given. Cleaning ~/.ssh/known_hosts"
 | 
			
		||||
		sed -i -e '/no hostip for proxy command/ d' ~/.ssh/known_hosts
 | 
			
		||||
	else
 | 
			
		||||
		hostname=$1
 | 
			
		||||
		ip=$(ssh admin dig +short $1)
 | 
			
		||||
		ip=$(ssh admin dig +short "$1")
 | 
			
		||||
		echo "Removing host ${hostname} from ~/.ssh/known_hosts"
 | 
			
		||||
		sed -i -e "/${hostname}/ d" ~/.ssh/known_hosts
 | 
			
		||||
		echo "Removing ip ${ip} from ~/.ssh/known_hosts"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user