Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@anuragregmi
anuragregmi / functions.py
Created July 1, 2022 12:04
Python test functions
def get_hello(name):
return f"hello {name}"
def say_hello(name):
print(get_hello(name))
def add(a, b):
return a + b
@anuragregmi
anuragregmi / cd_script.sh
Last active May 19, 2022 10:45
Override builtin cd to enable virtualenv on cd command
# include this in your .bashrc or .zshrc
function activateVenv() {
# if virtual env exits then source
if [ -d "./venv" ]
then
source ./venv/bin/activate
fi
}
Name--Maths--English--Science
Raju--60--50--70
Shyam--80--45--65
Baburao--40--40--40
@anuragregmi
anuragregmi / 40_custom
Created December 17, 2020 02:13
Grub config for phoenix os /etc/grub.d/40_custom
menuentry "Lineage x86" {
set root='(hd0, 2)'
linux /PhoenixOS/kernel quiet root=/dev/ram0 androidboot.selinux=permissive acpi_sleep=s3_bios,s3_mode SRC=/PhoenixOS
initrd /PhoenixOS/initrd.img
}
@anuragregmi
anuragregmi / vimrc
Created February 18, 2020 07:05
my vimrc
"" General
set number " Show line numbers
set linebreak " Break lines at word (requires Wrap lines)
set showbreak=+++ " Wrap-broken line prefix
set textwidth=100 " Line wrap (number of cols)
set showmatch " Highlight matching brace
set visualbell " Use visual bell (no beeping)
set hlsearch " Highlight all search results
set smartcase " Enable smart-case search
@anuragregmi
anuragregmi / pycahrm_shell_plus_console.md
Last active January 22, 2020 12:15
Running shell plus in python console pycharm
  1. Open settings of pycharm (Ctrl+Alt+S)

  2. Go to django console settings (Simply search "django console")

  3. In starting script replace with following

    Note: If you have different settings module, then set DJANGO_SETTINGS_MODULE in environment variable. Eg. DJANGO_SETTINGS_MODULE=config.settings

    Note: You must have django_extensions installed

import sys; print('Python %s on %s' % (sys.version, sys.platform))
import django; print('Django %s' % django.get_version())
@anuragregmi
anuragregmi / git-bare-repo-setup.md
Last active December 3, 2019 11:00
Setting Up bare repo on server

Set up Bare git repo on server

Create a folder to keep our code(work tree of git)

mkdir /home/user/app/

Create a folder for git (eg. repo.git) and cd

mkdir repo.git
cd repo.git
@anuragregmi
anuragregmi / qemu.md
Created April 4, 2019 05:16
creating qemu images and running virtual machine

Create image

  • 20G is size of your image, or hard disk for virtual machine
  • virtual.img is the image file
qemu-img create -f qcow2 virtual.img 20G

Booting img for first time for installation

  • 2G is RAM for virtual machine

Keybase proof

I hereby claim:

  • I am anuragregmi on github.
  • I am anurag_ (https://keybase.io/anurag_) on keybase.
  • I have a public key whose fingerprint is 15C2 3DC3 C140 FA27 30FF A802 04C6 82FF 8B83 0D6E

To claim this, I am signing this object:

@anuragregmi
anuragregmi / tmux.conf
Last active December 17, 2020 06:08
My config file for tmux
set -g prefix C-a
set -g mouse
unbind C-b
bind C-a send-prefix # Pass on ctrl-a for other apps
unbind %
unbind '"'
bind '\' split-window -h -c "#{pane_current_path}"
bind '"' split-window -v -c "#{pane_current_path}"