Bash: SSH with Tunnel

Syntax

ssh user@remoteHost.com -L 81:remoteHost:81

ssh user@192.168.0.112 -L 81:r192.168.0.112:81

Script

#!/bin/bash
function ssh-tunnel-112(){
        export $(grep -v '^#' .env | xargs)
        echo "ssh to .112:8081 to pi:3001"
        sudo ssh me@192.168.0.112 -L 8081:pi:3001
}
echo "creating tunnel on port 81"
ssh-tunnel-112

 

Tags

PHP: Passing Arguments from Bash To PHP

Resources:

Shell

echo "Testing destination dir -" $ytuDest

PHP Main

/*
 * Start of PHP CLI Script
 */
//require_once '/home/silosix/git/phpunitwebdriver/src/Shell/YtdlWrapper.php';
//require_once '../Shell/YtdlWrapper.php';
print "Downloading YT Videos: START"."\n";
print "parsing arguments"."\n";
parse_str($argv[2],$output);
var_dump($argv);
var_dump($output);
$ytuDest = $output['ytuDest'];
print "ytuDest=" .
Tags

Linux: Bash: Echo Commands

echo Options


 Options      Description
 -n      do not print the trailing newline.
 -e      enable interpretation of backslash escapes.
 \b      backspace
 \\      backslash
 \n      new line
 \r      carriage return
 \t      horizontal tab
 \v      vertical tab
Tags

Pi: Samba: Initial setup

Raspberry Pi change username

Sources:

Pi username change

log out
sudo passwd root
<root_passwd>

logout

usermod –l mdp pi
<mdp_passwd>

Check home dir

usermod –m –d/home/mdp mdp

Pi Password change

Logout
login mdp
passwd

Samba - list users

sudo pdbedit -L -v

Unix username:        jimmy
NT username:          
Account Flags:        [U          ]
User SID:             S-1-
Tags

Git: /.git/hooks/post-commit to push to origin repo on commit

Some applications - such as gitg - make available LOCAL commits & branch management, but have no provision for PUSHING to the remote origin.

Luckly, git leverages 'hooks' that provide a means to add shell scripts for such a need.

Once a commit is done on a branch, git will call "/.git/hooks/post-commit" and - if present - will run the contained shell script.


#!/bin/bash

#
# post-commit web hook
#
#git push -u origin develop
git push -u origin ffsync-setup

#
# set this file to executable
#
# chmod 755 post-commit
#

this code block will push the ffsync-setup branch to the remote origin

 

Tags
Subscribe to