Skip to content

Instantly share code, notes, and snippets.

View memandip's full-sized avatar
🎯
Focusing

Mandip Tharu memandip

🎯
Focusing
  • Kathmandu, Nepal
View GitHub Profile
@memandip
memandip / setup-nerd-fonts
Created March 26, 2025 15:21
SETUP HACK NERD FONTS FOR STARSHIP SHELL WITH ZSH
## FOR MAC
- install `font-hack-nerd-font`
- brew install font-hack-nerd-font
- Go to iterm2 setting
- select `Profiles` tab
- select `Text` tab
- check `Use a different font for non-ASCII text`
- search and select `Hack Nerd Font`
@memandip
memandip / py-venv-amplify
Created February 12, 2023 11:31
Enable python virtual env to use different python version with aws amplify
- Create virtual env with python `python -m venv my_venv`
- Install required virtual env for target python version
- For eg: if python version is 3.9
- `sudo apt-get install python3.9-venv`
- Change python version for your virtual env
- `virtualenv --python="{{path to target python}}" "/path/to/new/virtualenv/"`
- `virtualenv --python="/usr/bin/python3.9" "{{my_venv}}"
- update your python version in cloudformation file and Pipfile
- amplify push
@memandip
memandip / nginx.conf
Created December 10, 2021 09:19
Nginx configuration with laravel and static site. Routes with prefix `api` will be handled by laravel
server {
server_name mydomain.com;
charset utf-8;
root /var/www/html/{Laravel_Project_DIR}/current/public;
index index.html index.php;
lsof -P | grep ':PortNumber' | awk '{print $2}' | xargs kill -9
@memandip
memandip / gist:b2219f71308861c8e72c6b05540e720b
Created September 25, 2021 07:44
fix zsh insecure directories error
copy the following script in your .zshrc file
# Fix permission for zsh. It should be on the first line to work.
export ZSH_DISABLE_COMPFIX=true
@memandip
memandip / removeEmptyOrUndefined
Created July 29, 2021 09:30
Remove empty or undefined elements from nested object
export const removeEmptyOrUndefined = (obj: any) => {
let finalObj: any = {};
Object.keys(obj).forEach((key) => {
if (obj[key] && typeof obj[key] === 'object') {
const nestedObj = removeEmptyOrUndefined(obj[key]);
if (Object.keys(nestedObj).length) {
finalObj[key] = nestedObj;
}
} else if (obj[key] !== '' && obj[key] !== undefined && obj[key] !== null) {
finalObj[key] = obj[key];
@memandip
memandip / gist:aadaf2eba250095f55cb49cff4f71b57
Created May 10, 2021 08:19
Fix sql_mode ONLY_FULL_GROUP_BY
functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
@memandip
memandip / gist:9db4310f448ebd4be6aef3de2f0e2a10
Created April 20, 2021 05:17
Install ZSH and make zsh your default shell
1. sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
2. chsh -s $(which zsh)
3. change ZSH_THEME="agnoster" or any other theme of your preference in ~/.zshrc file
@memandip
memandip / tmux-commands
Created March 7, 2021 06:10
TMUX essentials
Prefix for the following commands: Ctrl + B
1) New window: "+ C"
2) Switch window : "+ (window number)"
3) Next window: "+ n"
4) Previous window: "+ p"
5) Rename window: "+ ,"
6) View windows: "+ w"
7) Horizontal split: "+ %"
8) Vertical split: "+ ""
9) Detatch from session: "+ d"
@memandip
memandip / add-deploy-user
Last active December 8, 2021 20:24
add deploy user ubuntu server
- ssh root@<ubuntu-server-ip-address>
To start with, connect to your Ubuntu Server with SSH with root
`ssh root@<ubuntu-server-ip-address>`
Once you are logged in to your server with root,
you are ready to create the new deploy user that will be used from now on. To do that, type:
` adduser deploy `
Update deploy user privileges, by:
`usermod -aG sudo deploy`