Skip to content

Instantly share code, notes, and snippets.

@amit08255
amit08255 / conventional-commit-format.md
Last active December 25, 2020 19:38
Conventional Commit Format

Commit Message Format

We have very precise rules over how our Git commit messages must be formatted. This format leads to easier to read commit history.

Each commit message consists of a header, a body, and a footer.

<header>
// use (16 chars of) 'password' to encrypt 'plaintext'
function encrypt(plaintext, password) {
var v = new Array(2), k = new Array(4), s = "", i;
plaintext = escape(plaintext); // use escape() so only have single-byte chars to encode
// build key directly from 1st 16 chars of password
for (var i=0; i<4; i++) k[i] = Str4ToLong(password.slice(i*4,(i+1)*4));
@amit08255
amit08255 / rc4.js
Created June 16, 2021 07:42 — forked from farhadi/rc4.js
RC4 encryption in javascript and php
/*
* RC4 symmetric cipher encryption/decryption
*
* @license Public Domain
* @param string key - secret key for encryption/decryption
* @param string str - string to be encrypted/decrypted
* @return string
*/
function rc4(key, str) {
var s = [], j = 0, x, res = '';
/*
* RC4 symmetric cipher encryption/decryption
*
* @license Public Domain
* @param string key - secret key for encryption/decryption
* @param string str - string to be encrypted/decrypted
* @return string
*/
function rc4(key, str) {
var s = [], j = 0, x, res = '';
@amit08255
amit08255 / examples.js
Created July 4, 2021 07:03 — forked from dypsilon/examples.js
Lazy Continuation Monad in JavaScript
const Cont = require('./lazy-continuation');
// pointed version
const c = Cont.of(5) // initial value
.chain((x) => {
return Cont.of(x + 5); // synchronous computation
})
.chain((x) => { // async computation
return new Cont((resolve) => {
setTimeout(() => resolve(x + 15), 500);
@amit08255
amit08255 / bithack.cc
Created July 24, 2021 11:47 — forked from stephenLee/bithack.cc
bit manipulation tricks(collections)
/*
* Reference:
* http://www.quora.com/Computer-Programming/What-are-some-cool-bit-manipulation-tricks-hacks
* http://www.catonmat.net/blog/low-level-bit-hacks-you-absolutely-must-know/
*/
#include <iostream>
#include <string.h>
using namespace std;
@amit08255
amit08255 / PreventCopyPaste.js
Last active October 6, 2021 08:49 — forked from ststeiger/PreventCopyPaste.js
Prevent copy-paste and contextmenu
document.oncontextmenu = function(event) {
event.preventDefault();
event.stopPropagation();
return false;
};
document.addEventListener('contextmenu', function(event){
event.preventDefault();
event.stopPropagation();
@amit08255
amit08255 / bspwm.md
Created October 10, 2021 01:52
Bspwm Cheatsheet

bspwm/sxhkd cheat sheet

Common keys

@amit08255
amit08255 / react-phone-book.js
Created October 23, 2021 05:21 — forked from roshanlabh/react-phone-book.js
Coderbyte - React Phone Book [solution]
import React, { useState } from "react";
import ReactDOM from "react-dom";
const style = {
table: {
borderCollapse: "collapse",
},
tableCell: {
border: "1px solid gray",
margin: 0,
@amit08255
amit08255 / firefox-addon.md
Last active October 27, 2021 10:02
Installing custom addon in firefox

1. Disabling signing required in config

  • Type - about:config in address bar and press enter.
  • Search for xpinstall.signatures.required and double click to disable

2. Signing addon file

  • First select all addon files and convert to .zip file and rename extension to .xpi
  • Initialize the nodejs project in your computer using command npm init.