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 / kms.py
Created July 11, 2022 10:48 — forked from fuzzyami/kms.py
encrypt and decrypt with kms, boto3 and pyCrypto. Python2 compatible
#!/usr/bin/env python
import base64
from Crypto import Random
import boto3
from Crypto.Cipher import AES
PAD = lambda s: s + (32 - len(s) % 32) * ' '
@bmnepali
bmnepali / kms-demo.js
Created July 1, 2022 17:12 — forked from JoeShi/kms-demo.js
KMS demo using node.js
/**
* This is a demo of KMS.
*
* This demo includes the following two features:
* 1. encrypt and decrypt using CMK (Customer Master Key)
* 2. encrypt and decrypt using data key (Envelope encryption using AWS KMS)
*
*/
'use strict';
@bmnepali
bmnepali / !react-enzyme-render-methods.md
Created September 9, 2020 01:39 — forked from richardscarrott/!react-enzyme-render-methods.md
react-enzyme - `shallow` vs `mount` vs `render` lifecycle methods

An exploration of the different render methods available in react-enzyme.

@bmnepali
bmnepali / index.html
Created August 20, 2020 01:37 — forked from imgerson/index.html
Interactive video with HTML5 and JavaScript
<!DOCTYPE html>
<html>
<head>
<title>Basic interactive video with HTML5 and vanilla JavaScript</title>
</head>
<body>
<!-- Read my blog post on interactive videos: https://mostlydevstuff.com/2018/basic-interactive-video-with-html5-and-javascript/ -->
<style>
@bmnepali
bmnepali / nodejs-cheatsheet.js
Created August 9, 2020 18:46 — forked from LeCoupa/nodejs-cheatsheet.js
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@bmnepali
bmnepali / main.dart
Created May 30, 2020 13:44 — forked from jebright/main.dart
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(
@bmnepali
bmnepali / spring-boot-cheatsheet.java
Created February 12, 2020 10:39 — forked from jahe/spring-boot-cheatsheet.java
Spring Boot Cheatsheet
// Enable component-scanning and auto-configuration with @SpringBootApplication Annotation
// It combines @Configuration + @ComponentScan + @EnableAutoConfiguration
@SpringBootApplication
public class FooApplication {
public static void main(String[] args) {
// Bootstrap the application
SpringApplication.run(FooApplication.class, args);
}
}
@bmnepali
bmnepali / axios-catch-error.js
Created July 28, 2019 10:18 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@bmnepali
bmnepali / enzyme_render_diffs.md
Created July 3, 2019 05:45 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@bmnepali
bmnepali / semantic-layout.html
Created July 2, 2019 09:35 — forked from thomd/semantic-layout.html
Standard HTML5 Semantic Layout
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Title</title>
<link href="stylesheets/main.css" rel="stylesheet" />
</head>
<body>
<header>
<hgroup>