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: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:84f10dcc0a0a73fd366d
Created January 6, 2015 16:23
openssl certificate expiry date
#get certificate issuer/expiry date
$echo | openssl s_client -connect google.com:443 2>/dev/null | openssl x509 -noout -issuer -subject -dates
issuer= /C=US/O=Google Inc/CN=Google Internet Authority G2
subject= /C=US/ST=California/L=Mountain View/O=Google Inc/CN=*.google.com
notBefore=Dec 11 12:49:14 2013 GMT
notAfter=Apr 10 00:00:00 2014 GMT
# Hash value
$ echo | openssl s_client -connect google.com:443 2>/dev/null | openssl x509 -noout -hash
a18bd28a
@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

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@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)

Developer Cheat Sheets

This are my cheat sheets that I have compiled over the years. Tired of searching Google for the same things, I started adding the information here. As time went on, this list has grown. I use this almost everday and this Gist is the first bookmark on my list for quick and easy access.

I recommend that you compile your own list of cheat sheets as typing out the commands has been super helpful in allowing me to retain the information longer.

@tuxfight3r
tuxfight3r / vim-shortcuts.md
Last active May 3, 2024 05:11
VIM SHORTCUTS

VIM KEYBOARD SHORTCUTS

MOVEMENT

h        -   Move left
j        -   Move down
k        -   Move up
l        -   Move right
$        -   Move to end of line
0        -   Move to beginning of line (including whitespace)
@tuxfight3r
tuxfight3r / ssh-keygen
Last active August 8, 2023 08:27
ssh key / fingerprint tricks
#Read multiple keys from an authorized_keys file and print the finger print
[root@server01 .ssh]# while read line; do ssh-keygen -l -f /dev/stdin <<< $line; done < authorized_keys
2048 87:7a:4d:70:d2:10:a4:4b:b7:e1:2b:7c:77:92:25:04 /dev/stdin (RSA)
2048 7d:f0:89:94:00:09:bc:70:46:59:8d:9a:70:3b:ac:70 /dev/stdin (RSA)
2048 61:63:ee:0d:f6:d2:d8:d6:ae:37:0c:35:ae:da:51:6a /dev/stdin (RSA)
#read a key from authorized key file
[root@server01 .ssh]# ssh-keygen -l -f authorized_keys
2048 87:7a:4d:70:d2:10:a4:4b:b7:e1:2b:7c:77:92:25:04 authorized_keys (RSA)
@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:38b41e7a3bb549552cbc
Last active April 21, 2022 00:36
ansible basics
#Install Ansible from EPEL
yum install ansible ansible-lint
#Update config file for ansible
cat >> /etc/ansible/hosts <<EOF
192.168.0.1
[web_servers]
192.168.0.20