Skip to content

Instantly share code, notes, and snippets.

View psachin's full-sized avatar
🚀
Evolving

Sachin psachin

🚀
Evolving
View GitHub Profile
@psachin
psachin / normalize.py
Last active August 29, 2015 14:05
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.
@psachin
psachin / magit.el
Last active December 22, 2015 00:09
Custom commit.template for magit-1.2.0
;; 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
@psachin
psachin / prompt.sh
Last active February 16, 2016 05:38
My bash Prompt
# `bashPrompt.sh` is located at: https://raw.githubusercontent.com/psachin/bash_scripts/master/bashPrompt.sh
source bashPrompt.sh
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
psachin / looping_ips.sh
Last active April 18, 2016 05:14
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 192.168.0.1 -C "echo 192.168.0.2 >> ~/ips"
# ssh 192.168.0.2 -C "echo 192.168.0.3 >> ~/ips"
# ssh 192.168.0.3 -C "echo 192.168.0.4 >> ~/ips"
# ssh 192.168.0.4 -C "echo 192.168.0.1 >> ~/ips"
x="192.168.0.1 192.168.0.2 192.168.0.3 192.168.0.4"
arr=($(echo $x | tr " " "\n"))
@psachin
psachin / local.conf
Last active December 21, 2016 06:34
devstack-on-fedora24-on-rhevm
[[local|localrc]]
HOST_IP=10.65.10.65
SERVICE_HOST=10.65.10.65
MYSQL_HOST=localhost
RABBIT_HOST=10.65.10.65
GLANCE_HOSTPORT=10.65.10.65:9292
ADMIN_PASSWORD=redhat
DATABASE_PASSWORD=redhat
RABBIT_PASSWORD=redhat
SERVICE_PASSWORD=redhat
@psachin
psachin / setup_manageiq_fedora.sh
Last active January 3, 2017 10:52
ManageIQ on Fedora(single script setup)
# Single script to setup ManageIQ development environment on Fedora
# Usage:
# - It is recommended to have fresh(and dedicated) Fedora installation
# - Download THIS script and execute using the command
# ~~~
# bash setup_manageiq_fedora.sh
# ~~~
# Tested on Fedora 24, 25
@psachin
psachin / test-stack.yml
Last active September 29, 2017 07:17
Simple heat stack(Tested on quickstart environment with OpenStack Ocata release)
heat_template_version: 2016-10-14
description: Simple template to deploy a single compute instance. Need to change image name
parameters:
image:
type: string
description: Image name or id
default: cirros
@psachin
psachin / battery.diff
Created November 7, 2017 04:20
Making below changes battery status shows correctly
diff --git a/lisp/battery.el b/lisp/battery.el
index b1834f06ff8d..dd0b8f652426 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -58,7 +58,7 @@
((and (eq system-type 'gnu/linux)
(file-directory-p "/proc/acpi/battery"))
#'battery-linux-proc-acpi)
- ((and (eq system-type 'gnu/linux)
+ ((and (or (eq system-type 'gnu/linux) (eq system-type 'gnu))
@psachin
psachin / tripleo-quickstart.org
Last active November 30, 2017 10:19
Notes from tripleo-quickstart bootcamp session

ooo-quickstart

All in one(single physical node deployment)

adduser NON-ROOT-USER -G wheel
passwd NON-ROOT-USER

# login as NON-ROOT-USER
ssh-keygen
export VIRTHOST=127.0.0.2
ssh-copy-id root@$VIRTHOST
@psachin
psachin / wrk_mem.sh
Last active December 27, 2017 08:04
Check workers with exceeded memory on Red Hat CloudForms
# Author: Niladri Roy <niroy@redhat.com>
# Usage:
# 1) without specifing evm.log file
# curl -s https://gist.githubusercontent.com/psachin/36c7e4ff04bdd0a07a64065d0c477eaf/raw | bash -
# 2) specify file name
# curl -s https://gist.githubusercontent.com/psachin/36c7e4ff04bdd0a07a64065d0c477eaf/raw | bash -s evm.log-20171103
if [ -z $1 ];
then
EVM="evm.log"