Skip to content

Instantly share code, notes, and snippets.

View bmnepali's full-sized avatar
🏠
Working from home

Buddha Man Nepali bmnepali

🏠
Working from home
View GitHub Profile
@bmnepali
bmnepali / getDayFromDate.java
Last active March 19, 2020 12:01
Get full fay name from given date
public class GetDayFromDate {
public static void main(String[] args) {
Date now = new Date();
SimpleDateFormat simpleDateformat = new SimpleDateFormat("E"); // the day of the week abbreviated
System.out.println(simpleDateformat.format(now));
simpleDateformat = new SimpleDateFormat("EEEE"); // the day of the week spelled out completely
@bmnepali
bmnepali / node-encrypt-decrypt.js
Created January 29, 2020 10:29
Node Js Crypto encrypt and decrypt methods for secure data encryption.
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
@jebright
jebright / main.dart
Created April 16, 2019 19:12
Using an Isolate in Flutter
import 'dart:async';
import 'package:flutter/material.dart';
import 'dart:isolate';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(