Skip to content

Instantly share code, notes, and snippets.


Sachin psachin

View GitHub Profile
gbraad /
Created Jun 23, 2016
Install TripleO on baremetal using Quickstart

Install TripleO on baremetal using Quickstart

This gist contains the files and scripts used to deploy to baremetal. Be aware wasn't really used in this way. The steps were actually performed from an interactive session (due to issues with the overcloud loosing connectivity).

The undercloud image needs to be build or download and stored in /var/lib/oooq-images/.

psachin /
Last active Apr 18, 2016
Objective is to ssh IPaddr in an array and use the consecutive IPaddr in the conf file. It should complete one full loop. See example in the comment.
#!/usr/bin/env bash
# Objective is to ssh IPaddr in an array and use the consecutive IPaddr in the conf file.
# Something like this:
# ssh -C "echo >> ~/ips"
# ssh -C "echo >> ~/ips"
# ssh -C "echo >> ~/ips"
# ssh -C "echo >> ~/ips"
arr=($(echo $x | tr " " "\n"))
psachin /
Last active Aug 29, 2015
Import data as a Matrix and normalize its values by finding the mean of each column
#!/usr/bin/env python
import numpy as np
# Know the delimiter used(Useful to differentiate between a space and tab).
# f = open('test.txt')
# lines = f.readlines()
# print lines
# Uncomment below line to import data from a file.
brenopolanski /
Last active Jun 28, 2022
Merge multiple PDFs using Ghostscript

A simple Ghostscript command to merge two PDFs in a single file is shown below:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf

Install Ghostscript:

Type the command sudo apt-get install ghostscript to download and install the ghostscript package and all of the packages it depends on.

psachin /
Last active Feb 16, 2016
My bash Prompt
# `` is located at:
PS1='\n{\[\033[35m\]$(current_date)\[\e[0m\]}\n[\[\e[01;30m\]\w\[\e[0m\]]-(\[\033[35m\]$(list_dirs) dirs, $(list_files) files\[\e[0m\])\n\[\e[0;34m\]\u\[\e[0m\]\[\e[0;35m\]@\[\e[0m\]\[\e[0;31m\]\h\[\e[0m\]\[\e[0;32m\]:\[\e[0m\]\[\e[0;32m\]$(parse_git_branch)$(which_user)\[\e[0m\] '
psachin / magit.el
Last active Dec 22, 2015
Custom commit.template for magit-1.2.0
View magit.el
;; Commit template location.
;; It can also be ~/.gitmessage.txt
(defcustom commit-template "./.git/COMMIT_EDITMSG"
"Path to custom message template file. If nil, no custom
message will be inserted to *magit-edit-log* buffer. The path can
be relative as well as absolute."
:group 'magit
:type 'string)
;; and modify this function accordingly
dmgerman / directory-files-recursive.el
Last active May 1, 2022
Recursively list files in a given directory
View directory-files-recursive.el
;;; Recursively list files in a given directory
;;; Author: daniel m german dmg at uvic dot ca
;;; Copyright: daniel m german
;;; License: Same as Emacs
(defun directory-files-recursive (directory match maxdepth ignore)
"List files in DIRECTORY and in its sub-directories.
Return files that match the regular expression MATCH but ignore