Skip to content

Instantly share code, notes, and snippets.

@AjeetK
AjeetK / .bash_aliases
Last active December 9, 2015 19:40
custom aliases to shorten the unix commands. Make a file ~/.bash_aliases and source the ~/.bashrc file.
alias cls='clear'
alias pag='ps aux | grep'
alias nreload='sudo servince nginx reload'
alias nstop='sudo service nginx stop'
alias nstart='sudo servince nginx start'
alias nrestart='sudo service nginx restart'
alias ebe='ember build --environment='
alias chmodx='sudo chmod +x'
alias epreprod='RAILS_ENV=pre_prod'
alias eprod='RAILS_ENV=production'
@AjeetK
AjeetK / linux_users_management.md
Last active July 10, 2024 16:57
User Management in Linux

Types of user:

  1. Root User - It is the super user which can run any command generally used for administration.
  2. System User - Users needed for system specific operation/components, like mysql user to run mysql.
  3. Normal User - Other users which are created by root and have limited access given to them.

Attributes:

  1. User Type: Super user
  2. User Name: root
@AjeetK
AjeetK / reset_root_passowrd.md
Created September 27, 2017 19:28
Reset MySQL "root" User Password

How To Reset "root" User Password In MySQL

Following are the set of commands to be run to reset root user password:

# 1. Stop mysql process
> sudo service mysqld stop

# 2. Change user to mysql & run mysql process using --skip-grant-tables option
> sudo su - mysql
@AjeetK
AjeetK / dynamo_lambda.js
Last active October 28, 2017 15:31
lambda function with dynamodb
console.log('Loading event');
var AWS = require('aws-sdk');
var dynamodb = new AWS.DynamoDB();
exports.handler = function(event, context) {
console.log("Request received:\n", JSON.stringify(event));
console.log("Context received:\n", JSON.stringify(context));
var tableName = "myinfo";
var datetime = new Date().getTime().toString();
@AjeetK
AjeetK / jenkins_docker.md
Created November 11, 2017 17:05
Adding jenkins User To Docker Group
DOCKER_SOCKET=/var/run/docker.sock
DOCKER_GROUP=docker
JENKINS_USER=jenkins

if [ -S ${DOCKER_SOCKET} ]; then
DOCKER_GID=$(stat -c '%g' ${DOCKER_SOCKET})
sudo groupadd -for -g ${DOCKER_GID} ${DOCKER_GROUP}
sudo usermod -aG ${DOCKER_GROUP} ${JENKINS_USER}
fi
#!/bin/bash
echo "Updates packages"
sudo apt-get update -y
echo "Installing packages"
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev nodejs -y
echo "Installs RVM (Ruby Version Manager) for handling Ruby installation"
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
@AjeetK
AjeetK / Elasticsearch-container.sh
Last active April 7, 2018 10:06
Running Elasticsearch in Container
#!/bin/bash
###
# This is the first part which can be used to prepare base-image
###
# output log of userdata to /var/log/user-data.log
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
# Install awscli
@AjeetK
AjeetK / fluentd-es-ds.yml
Last active October 27, 2018 21:51
Fluentd Configmap For Kubernetes
apiVersion: v1
kind: ServiceAccount
metadata:
name: fluentd-es
namespace: default
labels:
k8s-app: fluentd-es
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
---
@AjeetK
AjeetK / fluentd-configmap.yml
Last active October 27, 2018 21:56
Fluentd Configmap For Kubernetes
kind: ConfigMap
apiVersion: v1
metadata:
name: fluentd-es-config-v0.1.5
namespace: default
labels:
addonmanager.kubernetes.io/mode: Reconcile
data:
system.conf: |-
<system>