Skip to content

Instantly share code, notes, and snippets.

View prameshbajra's full-sized avatar
💻
Let's talk tech.

Pramesh Bajracharya prameshbajra

💻
Let's talk tech.
View GitHub Profile
@prameshbajra
prameshbajra / Diamond.java
Created June 7, 2018 13:20
Diamond Pattern in java.
package com.demo.advjava;
public class StarsPattern {
public static void main(String[] args) {
printStars90(10);
printStarsRev(10);
// printStarsRev(10);
printStars(10);
}
@prameshbajra
prameshbajra / shareNode.js
Last active June 8, 2018 12:36
Share files locally in very high speed.
const cluster = require('cluster');
if (cluster.isMaster) {
cluster.fork();
cluster.on('exit', function(worker, code, signal) {
cluster.fork();
});
}
@prameshbajra
prameshbajra / chat.js
Created June 8, 2018 13:22
Tiny api communicator that acts as chat messenger. Made in less than 15 mins. Work locally only.
const cluster = require('cluster');
if (cluster.isMaster) {
cluster.fork();
cluster.on('exit', function(worker, code, signal) {
cluster.fork();
});
}
@prameshbajra
prameshbajra / Flask_JWT_Auth
Created February 13, 2019 10:45
Flask API JWT Authentication without database.
from flask import Flask
from flask_jwt import JWT, jwt_required, current_identity
from werkzeug.security import safe_str_cmp
class User(object):
def __init__(self, id, username, password):
self.id = id
self.username = username
self.password = password
@prameshbajra
prameshbajra / available_ip.sh
Created January 7, 2020 14:07
Gives the list of IPs that are Busy or Open.
#!/bin/sh
# Uncomment for debugging
#set -x
pingf(){
if ping -w 2 -q -c 1 192.168.1."$1" > /dev/null ;
then
printf "IP %s is up\n" 192.168.1."$1"
else
printf "IP %s is open\n" 192.168.1."$1"
fi
@prameshbajra
prameshbajra / available_ip.md
Created January 7, 2020 14:08
Gives the list of IPs that are Busy or Open.

Execute this by:

(777 might be an over kill for this one) sudo chmod 777 available_ip.sh

./available_ip.sh

@prameshbajra
prameshbajra / Assets.java
Last active January 27, 2020 10:06
Clone an Object/Arraylist in java.
import java.util.Date;
import java.util.List;
public class Assets {
public String formatId;
public String formatName;
public String assetId;
<mxfile host="app.diagrams.net" modified="2020-05-15T19:55:03.379Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36" etag="KWAAKfc1jvhACMIfshkV" version="13.1.1" type="device"><diagram name="Page-1" id="c7488fd3-1785-93aa-aadb-54a6760d102a">7LvXsuRIkiX4NS37NC3g5BGAg3PmIG/gnHN8/QA3IrMqq2p6emenZWRX9kqEO2CAmxlU1VTPUVP8G8x0Jz9HY6kOadb+GwSk57/Bn3+DIBCAiefrbbl+taDI74ZirtLfN/2twa7u7I9f/m7dqjRb/nLjOgztWo1/bUyGvs+S9S9t0TwPx19vy4f2r6OOUZH9U4OdRO0/t3pVupa/W0EA+NsFIauK8vfQBPr7QhwlTTEPW/97vH+D4Pzn79flLvqjr9/3L2WUDsffNcHsv8HMPAzrr6PuZLL2le0fYvv1O+5/cPXPec9Zv/5nfgDFSEaAEBkDUIoQeP7ffvewR+32WxbMo1016tc5+r+W58ony8bnS8miua/64jnk2ucJngtVVMxR9/u51usPWS5H1bVR/5zR5dq1TyP4HCZl1aZKdA3bO89lfeT2xxldDnN1D/0a/XHzc3lef1vJ80B/f4f9/vJpflt/5J6lv8/+FO170kZx1tJ/KocZ2mF+LvXDz7yWdR6aPzX9jpg/nXNRV7WvAX+zOY366Hfz73kQz2nUVkX/HCePtLP5vV617R99P6rHgIgE8T8H+Lsr0AfHAOB3j3/X/ttYYPqfFfmHZrJ5zc6/a/qtWD4bumydr+eWP64Sv43s9yIE4d/nx99MGoeRfwfQX83l3xk0CGK/b45+L6Xiz/7/Zk7PwW+L+k9aF/RP1vWJ1uhpeUTQ
@prameshbajra
prameshbajra / GmailTemplateFooter.html
Created July 15, 2020 06:49
Send beautiful email to others using this footer.
<div style="background-color: #3385ff;
bottom: 0;
position: fixed;
text-align: center;
width: 100%;
padding: 20px 0 0 0;
margin-left: -8px;">
<a href="https://prameshbajra.github.io" target="_blank" style="color: white;
font-family: consolas;
font-size: 2.5em;
@prameshbajra
prameshbajra / Terminal settings
Created August 6, 2020 08:52
Setting for windows terminal
// This file was initially generated by Windows Terminal 1.0.1811.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",