Skip to content

Instantly share code, notes, and snippets.

View username1565's full-sized avatar
💭
Bitcoin: 1CCtFYeScZBS2AMJATXXKYBqBG1LjMEEzo

username1565

💭
Bitcoin: 1CCtFYeScZBS2AMJATXXKYBqBG1LjMEEzo
View GitHub Profile
<script>
//numberToEnglish.js - as JS script for including
/**
* Convert an integer to its words representation
*
* @author McShaman (http://stackoverflow.com/users/788657/mcshaman)
* @source http://stackoverflow.com/questions/14766951/convert-digits-into-words-with-javascript
*/
function numberToEnglish(n, and, space, chunk_delimiter) { //n - number string, then delimiters. And delimiter, space and chunk delimiter.
@username1565
username1565 / apt-cyg
Created November 12, 2019 15:01
Cygwin package manager
#!/bin/bash
# apt-cyg: install tool for Cygwin similar to debian apt-get
#
# The MIT License (MIT)
#
# Copyright (c) 2013 Trans-code Design
#
# 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
@username1565
username1565 / hexdump.js
Last active January 13, 2023 10:31 — forked from mkropat/hexdump.js
Simple hexdump in Javascript
function hexdump(buffer, blockSize) {
//determine the type of variable "buffer", and convert this to "string".
if(typeof buffer === 'string'){
//console.log("buffer is string");
//do nothing
}else if(buffer instanceof ArrayBuffer && buffer.byteLength !== undefined){
//console.log("buffer is ArrayBuffer");
buffer = String.fromCharCode.apply(String, [].slice.call(new Uint8Array(buffer)));
}else if(Array.isArray(buffer)){
//console.log("buffer is Array");
@username1565
username1565 / generate-entropy-on-mouse-moving.js
Last active September 22, 2020 20:32 — forked from akirattii/generate-entropy-on-mouse-moving.js
JS: How to generate a random entropy by mouse-moving on browser
// const entropy = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
const entropy = [];
let captureStart = false;
/**
* Mouse Moving Entropy Generator on browser.
* Returns an entropy which is 16 bytes long array of unsigned char integer (0-255).
*/
//$(document).on("mousemove", "html", function(e) { //JQuery (if JQuery was already included)
document.addEventListener('mousemove', function(e) { //Pure JavaScript. With this, this code working in console of browser, after "copy and paste" of this
@username1565
username1565 / 2019-https-localhost.md
Created February 8, 2021 19:00 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

;(function(){
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* SHA-256 implementation in JavaScript (c) Chris Veness 2002-2014 / MIT Licence */
/* */
/* - see http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html */
/* http://csrc.nist.gov/groups/ST/toolkit/examples.html */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* jshint node:true *//* global define, escape, unescape */
'use strict';
@username1565
username1565 / BBP_NthHexDigitOfPI.html
Last active December 21, 2021 15:58 — forked from retrohacker/pi.text
First 8336 HEX digits of pi
Open this in new tab, and see console.log (F12 button);
<script>
//first 8336 hexadecimal digits of pi: https://gist.github.com/retrohacker/e5fff72b7b75ee058924
//multiline string:
var pi_test_string = function(){/*
243F6A8885A308D313198A2E03707344A4093822299F31D0082EFA98EC4E6C89
452821E638D01377BE5466CF34E90C6CC0AC29B7C97C50DD3F84D5B5B5470917
9216D5D98979FB1BD1310BA698DFB5AC2FFD72DBD01ADFB7B8E1AFED6A267E96
BA7C9045F12C7F9924A19947B3916CF70801F2E2858EFC16636920D871574E69