Skip to content

Instantly share code, notes, and snippets.

View bikashthapa01's full-sized avatar
🏛️
Works At SmallAcademy

Bikash Thapa bikashthapa01

🏛️
Works At SmallAcademy
View GitHub Profile
@bikashthapa01
bikashthapa01 / menu.html
Created October 21, 2018 08:47
Simple Drop Down menu in CSS
.menu {
padding: 1rem;
background: orangered;
}
.menu ul {
list-style: none;
}
.menu ul li {
display: inline-block;
}
@bikashthapa01
bikashthapa01 / settings.py
Created November 4, 2018 12:49
Connect MYSQL Database in Django app
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'managerpro',
'USER': 'root',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '3325',
}
@bikashthapa01
bikashthapa01 / nodejs-login.js
Created November 5, 2018 13:51
Passport Login strategy and Expression Session For nodejs application created with MYSQL
//packages used
var session = require('express-session');
var MySQLStore = require('express-mysql-session')(session);
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
// express session setup and passport initialization
var options = {
@bikashthapa01
bikashthapa01 / hashing.js
Created November 5, 2018 13:56
Hash user Password before inserting into Database while Registering a user using bcrypt
// package used
var bcrypt = require('bcrypt-nodejs');
bcrypt.hash(password, null, null, function(err, hash) {
// password -> raw password ( req.body.password)
// hash -> hashed password
// connect and insert to database
var db = require('../db'); // open connection to database
# 1. Download & Install XAMPP Server From https://www.apachefriends.org/download.html & Run Apache and MYSQL from XAMPP Control Panel
# 2. Open Browser and Check http://localhost/phpmyadmin link is working ?
# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
@bikashthapa01
bikashthapa01 / lab1.tcl
Created November 16, 2018 04:32
VTU 15csl57 Network Simulator Program - 1
set ns [new Simulator]
set nf [open lab1.nam w]
$ns namtrace-all $nf
set tf [open lab1.tr w]
$ns trace-all $tf
proc finish { } {
global ns nf tf
$ns flush-trace
set ns [new Simulator]
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set f [open lab1a.tr w]
$ns trace-all $f
set nf [open lab1a.nam w]
set ns [new Simulator]
set nf [open lab3.nam w]
$ns namtrace-all $nf
set tf [open lab3.tr w]
$ns trace-all $tf
$ns color 1 Blue
set ns [new Simulator]
set nf [open lab2.nam w]
set tf [open lab2.tr w]
$ns namtrace-all $nf
$ns trace-all $tf
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
n = int(input("Enter No Of Students: "))
studentData = {}
for x in range(n):
usn = input(f"Enter Usn of {x} student: ")
marks = int(input("Enter Marks: "))
studentData[usn] = marks
# creating list from dictonary