Skip to content

Instantly share code, notes, and snippets.

View edr3x's full-sized avatar
🦥
Naffing

Anuj Dhungana edr3x

🦥
Naffing
View GitHub Profile

Changing Default Terminal to Alacritty in XFCE4

First install dpkg from your package manager

go to directory

cd /usr/local/bin
@edr3x
edr3x / tmux-sessionizer.sh
Last active December 21, 2022 12:17
Guide on using fzf and tmux to make project navigation faster
#!/usr/bin/env bash
if [[ $# -eq 1 ]]; then
selected=$1
else
selected=$(find ~/projects ~/tests -mindepth 1 -maxdepth 1 -type d | fzf)
fi
if [[ -z $selected ]]; then
exit 0
@edr3x
edr3x / fizzbuzz.md
Last active April 29, 2023 12:46
fizzbuzz

JavaScript

function fizzBuzz(num) {
    for (let i = 1; i < num; ++i) {

        let out = "";

        if (i % 3 === 0)
            out += "Fizz";
@edr3x
edr3x / Neovim-Native-Lsp.md
Last active February 1, 2023 13:33
Easy way to set up Neovim Native LSP

NVIM LSP setup

Easy Guide on Setting Native Neovim LSP with Lua

Prerequisites

  • Node.js & npm
  • package manager for nvim (recommended: Packer ) you can also use lazy or Vim-Plug

Install required packages

@edr3x
edr3x / Dockerfile.go.md
Last active February 18, 2023 16:38
Dockerfile for containerizing golang projects
FROM golang:alpine as builder

RUN mkdir /build

ADD . /build

WORKDIR /build

RUN go build -o main .
@edr3x
edr3x / countlines.sh
Created April 10, 2023 07:12
Count number of lines of a file or all files on a folder
#!/usr/bin/env bash
function count_lines {
local file="$1"
local lines=$(wc -l < "$file")
echo "$lines"
}
function count_lines_recursive {
local dir="$1"
@edr3x
edr3x / cpuse.sh
Created April 15, 2023 12:58
print current cpu usae of a system
#!/usr/bin/env bash
cat /proc/stat | grep cpu | tail -1 | awk '{print ($5*100)/($2+$3+$4+$5+$6+$7+$8+$9+$10)}' | awk '{print 100-$1}' | xargs printf "%.1f"
@edr3x
edr3x / .env
Last active August 7, 2023 12:26
for running postgres on your machine via docker for Node.js
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_DB=mydatabase
DB_HOST=localhost
DB_PORT=5432
DB_SCHEMA=public
DB_VOL_NAME=mydbvol
# don't change anything on this key
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:${DB_PORT}/${POSTGRES_DB}?schema=${DB_SCHEMA}"
@edr3x
edr3x / Dockerfile.rust.md
Created July 10, 2023 20:06
dockerfile for containerizing rust
FROM rust as planner

WORKDIR /app

RUN cargo install cargo-chef

COPY . .

RUN cargo chef prepare --recipe-path recipe.json
@edr3x
edr3x / mailer.go
Last active December 14, 2023 06:53
bulk email sender
package main
import (
"fmt"
"log"
"net/smtp"
"os"
"sync"
"github.com/gofiber/fiber/v2"