Skip to content

Instantly share code, notes, and snippets.

View tuxfight3r's full-sized avatar
:octocat:
Working from home

Mohan Balasundaram tuxfight3r

:octocat:
Working from home
View GitHub Profile
@tuxfight3r
tuxfight3r / gist:593f35f297f8b619a470
Created November 28, 2014 18:43
openssh proxy tricks
METHOD 1: (with nc in localbox)
ssh -D 60002 mohan@10.1.1.20
sftp -o 'ProxyCommand=nc -xlocalhost:60002 %h %p' USER@remotehost.com
METHOD 2: (with nc in remote box)
sftp -o 'ProxyCommand ssh -q -l mohan 10.1.1.20 nc remotehost.com 22' USER@remotehost.com
METHOD 3: (without nc at all)
ssh -L 60002:remotehost.com:22 mohan@10.1.1.20
sftp -o Port=60002 USER@localhost

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tuxfight3r
tuxfight3r / puppet-bootstrap
Last active August 29, 2015 14:11
kickstart post reboot puppet bootstrap script
#!/bin/bash
#
#puppet bootstrap script
#
#chkconfig: 2345 99 99
#description: simple bash script to run puppet after reboot
#Date: 16/12/2014
#Author:Mohan
#Bootstrapping startup process
@tuxfight3r
tuxfight3r / gist:28c2c7367a9d315ff24b
Last active August 29, 2015 14:12
Bash hash trick with compgen for rpmbuilds
#Declare Variables
cat > cas <<EOF
#CAS TEST CONFIG
# Vars starting with APP_ are used to replace contents in skeletons files
APP_HTTP_PORT=12385
APP_HTTPS_PORT=12386
APP_AJP_PORT=12387
APP_HTTP_MAX_THREADS=150
@tuxfight3r
tuxfight3r / gist:c40c7eedacbeeaca4dfb
Created January 6, 2015 17:22
Hard reset server via Remote CLI
#If your Kernel is compiled with CONFIG_MAGIC_SYSRQ (sysrq-trigger).
#If so, you have the possibility so send binding command.
Reset your server (like pressing the hardware RESET button) :
# echo b > /proc/sysrq-trigger
Sync the hard disks before:
# echo s > /proc/sysrq-trigger
@tuxfight3r
tuxfight3r / proftpd.conf
Created January 12, 2015 22:41
PROFTPD - SFTP CONFIGURATION
# This is the ProFTPD configuration file
#
# See: http://www.proftpd.org/docs/directives/linked/by-name.html
# Server Config - config used for anything outside a <VirtualHost> or <Global> context
# See: http://www.proftpd.org/docs/howto/Vhost.html
# Trace logging, disabled by default for performance reasons
# (http://www.proftpd.org/docs/howto/Tracing.html)
@tuxfight3r
tuxfight3r / ssh-agent.sh
Created January 27, 2015 14:52
ssh-agent tricks
##SSHAGENT PPID TRICK for DESKTOP
#source ~/.ssh-agent.sh in your .bashrc
SSHAGENTPPID=$(ps -eo ppid,comm|awk '/ssh-agent/ {print $1}')
if [ -n "$SSHAGENTPPID" ]
then
export SSH_AUTH_SOCK=`ls /tmp/ssh*/agent.$SSHAGENTPPID`
export SSH_AGENT_PID=`pgrep -P $SSHAGENTPPID ssh-agent`
echo "SSH agent pid $SSH_AGENT_PID";
@tuxfight3r
tuxfight3r / gist:94298e7bc2a2aa65448b
Created February 11, 2015 13:50
Firefox/Chrome - html5 notepad
#Turn your browser into notepad
data:text/html, <html contenteditable>
@tuxfight3r
tuxfight3r / rmp.conf
Last active August 29, 2015 14:15
proftpd shared ACL Setup
#RMP Top Folder Permissions
<Directory /sftp/home/rmp_inbound/>
#Default Deny all
<Limit ALL>
DenyAll
</Limit>
# Allow Full Access - RMP internal group
<Limit CWD WRITE STAT LSTAT DIRS READ>
@tuxfight3r
tuxfight3r / rmp-logsplit.sh
Created February 18, 2015 21:24
proftpd xferlog logsplit script
[root@server02 scripts]# cat rmp-logsplit.sh
#!/bin/bash
#Date:08/01/2015
#Purpose:Provide Everyday the previous day Transfer logs for RMP as logrotate runs weekly
#Daily logs are available under location /sftp/home/rmp_inbound/Logs/sftp-xfer-201x-xx-xx.log
#place the log under /opt/scripts/ and run under cron for logs
#Author: Mohan
#Yesterdays date for logfile as cron is run the following day
#Output: "2014-01-08"