Skip to content

Instantly share code, notes, and snippets.

View paneru-rajan's full-sized avatar
🇳🇵

Rajan Paneru paneru-rajan

🇳🇵
View GitHub Profile
@paneru-rajan
paneru-rajan / gnome-terminal.md
Last active February 2, 2022 08:00
[One Instance Gnome Terminal] #gnome-terminal #terminal

Force Only one instance of Gnome Terminal

I use tmux and I prefer only one instance of gnome-terminal open all the time. With the following script I achieve:

  1. Open a new terminal if there is no any terminal opened
  2. If terminal is already opened it will bring that terminal to the active workspace and focuses it
  3. If you execute script sitting on the active terminal, it minimizes the terminal

Steps:

@paneru-rajan
paneru-rajan / tunnel-mysql-login.sh
Created October 17, 2019 05:05
[Use SSH tunnel to login into DB] You can use tunnel form cli to login to dbs #login-mysql #login-using-tunnel #mysql #tunnel
# you need to have mysql-client in your local
ssh -f rane-bastion-api -L 3307:db-host:3306 -N
mysql -u rajan_p -h 127.0.0.1 -P 3307 -p
@paneru-rajan
paneru-rajan / lepton-on-ubunut.md
Created July 13, 2018 12:35
[Install Lepton in ubuntu] Installing Lepton in ubuntu 18 #ubuntu #lepton #gist

Steps To install Lepton on ubunut

I have installed in ubunut 18

Goto Releases page on Github and get latest file having .AppImage in end and replace that with mine in below code:

cd /opt/
sudo wget https://github.com/hackjutsu/Lepton/releases/download/1.6.3-beta/Lepton-1.6.3-beta.1-x86_64.AppImage
sudo chmod a+x Lepton-1.6.3-beta.1-x86_64.AppImage
sudo ./Lepton-1.6.3-beta.1-x86_64.AppImage
@paneru-rajan
paneru-rajan / remove-file.md
Last active July 7, 2018 06:54
[Git Remove one file form entire repository and history] When some file mistakenly added on git, and after many commits you come to realize that the file was not supposed to be there #git #remove-file #bitbucket #github

Remove file form git history and current head (Remove Completely)

Note: I have tested this on my bitbucket dummy repo

I have mistakely added password on README.md and after many commits, I was reminded what I have done. So the below stuff is to correct my fault

Download from here

wget http://repo1.maven.org/maven2/com/madgag/bfg/1.13.0/bfg-1.13.0.jar
@paneru-rajan
paneru-rajan / django-webpack.md
Created June 27, 2018 17:56
webpack.config.js, package.json sample for a typical project

Package Json file

Filename package.json

{
  "name": "rane_monitoring_django_app",
  "version": "1.0.0",
  "description": "Web application for RANE",
  "main": "index.js",
  "scripts": {
@paneru-rajan
paneru-rajan / nested_to_flat.md
Created June 26, 2018 19:08
Nested arrays of integers into a flat array

Nested arrays of integers into a flat array

For simplicity i have used JS, and i am fully aware that flatArray() will give array of string, insted a array of numbers. Since js is loosely typed, it's okay to save like this. You can use flatIntigerArray() to get array as Integer array, i am supposing that i will receive intger nested array as said.

How to run this:

  1. Please open browser (I am using Chrome)
  2. Press CTRL+SHIFT+J
  3. Paste below code to see output

Javascript Function

@paneru-rajan
paneru-rajan / jupyter.md
Last active March 2, 2019 18:43
[Installation of jupyter notebook] Installation of jupyter notebook in ubuntu 18 and changing default directory #jupyter #ubuntu #ubuntu18.04 #ipython

Installation of jupyter notebook in ubuntu 18

Install using pip

use ignore-installed if you run into any problems in installations relating

Cannot uninstall ''. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

@paneru-rajan
paneru-rajan / installation.md
Last active April 19, 2020 20:52
[Installing different packges in Ubuntu 18.04] Everything I Installed in Ubuntu 18.04 #ubuntu18.04 #ubuntu #installation #docker-compose #nodejs #npm #docker #elastic-search

List of Different application installation method

  1. Docker Link

    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    sudo groupadd docker
    sudo usermod -aG docker $USER
    
@paneru-rajan
paneru-rajan / supervisor.md
Last active June 1, 2018 06:57
[Supervisor Config file for django app] Configuration file for django, supervisor and gunicorn #gunicorn #supervisor #django

Supervisor configuraion file

  1. Create a file:
    cd /etc/supervisor/conf.d
    vim test.django.conf
    
  2. Paste content below:
    [program:test.django]
    

command=/home/rajan/.virtualenvs/django-Wkqw33bx/bin/gunicorn -b :8080 mysite.wsgi:application

@paneru-rajan
paneru-rajan / nginx.md
Last active June 1, 2018 06:58
[Nginx configuration for django] It serves static file from different folder #nginx #django #proxy

Nginx proxy configuration for django applications.

  1. Create a file
    vim /etc/nginx/sites-available/<filename>
    
  2. Paste below content and edit accordingly
    server {
    

listen 80;