Skip to content

Instantly share code, notes, and snippets.

@kumaraish
kumaraish / gist:138a43ce2a4b2aed2e2375e08011183a
Created September 1, 2018 18:12 — forked from oleksii-zavrazhnyi/gist:968e5ea87e99d9c41782
BASH Absolute path of current script
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

Is a useful one-liner which will give you the full directory name of the script no matter where it is being called from

These will work as long as the last component of the path used to find the script is not a symlink (directory links are OK). If you want to also resolve any links to the script itself, you need a multi-line solution:

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
@kumaraish
kumaraish / expecting.md
Created July 2, 2019 08:05 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
@kumaraish
kumaraish / jekyll.txt
Last active December 31, 2020 10:30
Installing Jekyll on Windows
References:
1. http://jekyllrb.com/docs/home/
2. https://labs.sverrirs.com/jekyll/
3. https://davidburela.wordpress.com/2015/11/28/easily-install-jekyll-on-windows-with-3-command-prompt-entries-and-chocolatey/
4. http://guides.rubygems.org/ssl-certificate-update/#installing-using-update-packages
Jekyll v3.x requires Ruby version >= 2.0.0.
Ruby installation
-installation via chocolatey
docker run
--user 0:0
--env MY_USR=$(id -u)
--env MY_GID=$(id -g)
<my_image>
bash -c 'zypper install -l -y xyz;
echo "dummy:x:$MY_USR:$MY_GID:eusers:$PWD:/bin/bash" >> /etc/passwd;
su - dummy -c "<command-to-be-run-with-host-users-permissions>"'
@kumaraish
kumaraish / gist:758000746b4430e74896c35728365d95
Created December 7, 2021 21:11 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes: