Skip to content

Instantly share code, notes, and snippets.

View abrarShariar's full-sized avatar
🎯
Focusing

Abrar Shariar abrarShariar

🎯
Focusing
View GitHub Profile
@abrarShariar
abrarShariar / secret-box-issue.js
Last active August 24, 2018 05:02
How to use nacl.secretbox.open(box, nonce, key)? #145
const decryptFile = (filePath, sKey) => {
fs.readFile(filePath, 'utf8', (err, data) => {
if (err) throw err;
let hash = computeSHA256(sKey);
let buffer = Buffer.from(hash.toString(CryptoJS.enc.Hex), 'hex');
let key = new Uint8Array(buffer);
buffer = Buffer.from(data.toString(CryptoJS.enc.Hex), 'hex');
let encryptedData = new Uint8Array(buffer);
@abrarShariar
abrarShariar / lab.sql
Created August 14, 2018 07:44
plsql lab final
// 1
DECLARE
eno emp.empno%TYPE;
ename emp.ename%TYPE;
salary emp.salary%TYPE;
CURSOR c_emp is
SELECT empno,ename,salary FROM emp where rownum < 6 order by salary desc;
BEGIN
OPEN c_emp;
LOOP
@abrarShariar
abrarShariar / plpgsql.sql
Created July 20, 2018 18:13
pl/pgsql sample code
DO $$
DECLARE
rec RECORD;
BEGIN
FOR rec IN SELECT * FROM transaction_status WHERE transaction_id = 31
LOOP
RAISE NOTICE '%', rec.status_msg;
END LOOP;
END;
$$ LANGUAGE plpgsql;
@abrarShariar
abrarShariar / task.sql
Created July 17, 2018 07:58
lab task adbms
create table sales (
id number(5) primary key,
customer_id number(10),
product_id number(5),
quantity number(5)
)
drop table sales;
drop table products;
@abrarShariar
abrarShariar / schema
Last active July 16, 2018 18:29
database schema - adbms project
user_type
id int primary key
type varchar
doctors
id int primary key
name varchar
designation varchar
@abrarShariar
abrarShariar / matrix_mul_thread.cpp
Created July 11, 2018 23:25
Matrix multiplication with threads
#include<iostream>
#include<thread>
#include<fstream>
using namespace std;
/*input
4 //number of matrix
2 2 //dimension
1 2
4 5
@abrarShariar
abrarShariar / round_robin.cpp
Created July 11, 2018 23:23
Round Robin Scheduling (pre-emptive)
#include<iostream>
#include<fstream>
#include<deque>
#include <algorithm>
using namespace std;
//input
/*
6 2 //totalProcess timeQuantum
@abrarShariar
abrarShariar / circle.cpp
Created July 9, 2018 04:18
Circle (8 quad) - Computer Graphics
#include<iostream>
#include <GL/gl.h>
#include <GL/glut.h>
using namespace std;
int R;
int h, k;
int startX, startY;
void drawAxes(){
@abrarShariar
abrarShariar / plsql_lab.sql
Created June 26, 2018 07:56
PLSQL lab tasks
describe emp;
describe dept;
select emp.empno from emp;
-- 1
DECLARE
e_no emp.empno % TYPE := :input_no;
ename emp.ename % TYPE;
@abrarShariar
abrarShariar / line_with_points.cpp
Created June 25, 2018 04:22
line with points using dd algo
#include<iostream>
#include <GL/gl.h>
#include <GL/glut.h>
using namespace std;
double x1 = 0;
double y1 = 0;
double x2 = 0;
double y2 = 0;