Skip to content

Instantly share code, notes, and snippets.

View xettri's full-sized avatar
🍻
Chill And Code

Bharat Rawat xettri

🍻
Chill And Code
View GitHub Profile
@xettri
xettri / standard_email_regex.js
Last active June 21, 2019 09:34
Standard email regex
/*
MIT License
Copyright (c) 2019 bcrazydreamer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@xettri
xettri / show_color_image_in_cmd.py
Last active May 28, 2019 03:54
The solution of how to show image in cmd without graphics. According to my PC the maximum good resolution is width=100 (On full screen of cmd). Enjoy the code. Example Outputs:- https://user-images.githubusercontent.com/31788510/58396366-d49d1180-803b-11e9-8bab-9531e23334fe.png https://user-images.githubusercontent.com/31788510/58396379-dbc41f80…
'''
Author: BCrazyDreamer
License: MIT
'''
import sys
from PIL import Image
pixel_symbol = "██"
@xettri
xettri / play_video_in_cmd.py
Last active May 30, 2019 10:39
The solution of how to play video in cmd without graphics. Enjoy the code.
'''
Author: BCrazyDreamer
License: MIT
Language: Python3
'''
import sys
from PIL import Image
pixel_symbol = "██"
/*
MIT License
Copyright (c) 2019 bcrazydreamer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
//----------------------------------Winston config file--------------------------------//
/*https://www.npmjs.com/package/winston*/
const winston = require('winston');
/*https://www.npmjs.com/package/bvalid*/
const bv = require('bvalid');
const logpath = "/var/log/application_name";
@xettri
xettri / Mongoose_Service_Universal.js
Last active August 23, 2020 14:54
Basic mongoose service. Now no need to create multiple services file for mongo, just pass models in it and use chaining method to call it.
/**
* In model index ----> module.exports all model file
* eg:-
* **Models**
* module.exports = {
* 'Login' : require('./Login'),
* 'Accounts : require('./Accounts')
* }
*
* Usage:--------------------------------------------------------------------------
import React, { Component } from 'react';
import {connect} from "react-redux";
class App extends Component {
constructor(props){
super(props);
this.state = {}
}
componentWillMount(){
html {
box-sizing: border-box;
-ms-overflow-style: scrollbar;
}
body{margin: 0 !important}
*,
*::before,
*::after {
box-sizing: inherit;
}
@xettri
xettri / simple-face-detection.js
Created December 16, 2019 11:20
Simple face detection in js
/*
Compact version of picojs https://github.com/tehnokv/picojs
live demo :- https://codepen.io/bcrazydreamer/pen/JjobdQM
*/
FaceDetect = {}
FaceDetect.unpack_cascade = function(bytes)
{
const dview = new DataView(new ArrayBuffer(4));
let p = 8;
@xettri
xettri / RaspberryPi_Moisture_Detection.js
Created December 26, 2019 10:35
Pin - 21 for gpio input and pin 20 is for gpio output if moisture detected.
/*
Install rpi-gpio using
npm install rpi-gpio -g
*/
const gpio = require('rpi-gpio');
var pin = 21;
var pin2 = 20;
gpio.setMode(gpio.MODE_BCM);