Skip to content

Instantly share code, notes, and snippets.

View gkucmierz's full-sized avatar
💻

Grzegorz Kućmierz gkucmierz

💻
View GitHub Profile
const walletBalanceChanged = balance => {
const GAS_PRICE = 1e10;
const TX_GAS = 40e3;
const TX_PRICE = GAS_PRICE * TX_GAS;
let txsNum = balance / TX_PRICE;
const txsLvls = [2, 10, 20];
if (txsNum <= 2) {
@gkucmierz
gkucmierz / nth-permutation.js
Created August 20, 2017 16:17 — forked from bcherny/nth-permutation.js
get nth permutation of a string
// (as: Array[Array[A]]) => Array[A]
function flatten (as) {
return as.reduce((a, b) => a.concat(b), [])
}
// (as: Array[A], a: A) => Array[A]
function without (as, a) {
const bs = as.slice(0)
bs.splice(as.indexOf(a), 1)
return bs
d=new Date
d.setMonth(8)
d.setDate(1)
d.setHours(0)
d.setMinutes(0)
d.setSeconds(0)
console.log(d, (+d*1e-3).toFixed())
// gold coin (krugerrand) oscilations generator
let context = new (window.AudioContext || window.webkitAudioContext)();
[4823, 10852, 18540].map(freq => {
let osc = context.createOscillator(); // instantiate an oscillator
osc.type = 'sine'; // this is the default - also square, sawtooth, triangle
osc.frequency.value = freq;
osc.connect(context.destination); // connect it to the destination
osc.start(); // start the oscillator
osc.stop(context.currentTime + 2); // stop 2 seconds after the current time
// ing business login
var pass = prompt().trim();
[].map.call(document.querySelector('.pass-holder').querySelectorAll('[type=password]'), (el, i) => {
if ([].slice.call(el.classList).indexOf('logFieldInactive') === -1) {
el.value = pass[i];
}
});
[].map.call($('#activeLoansTable tr'), el => {
return el.querySelectorAll('td')[2];
}).map(td=>td&&+td.innerText.replace(/[^\.0-9]/g, '')||0).reduce((acc, n)=>acc+n,0);
@gkucmierz
gkucmierz / serialize_deserialize_file.sh
Created March 24, 2017 18:36
serialize and deserialize any file in bash
# serialize
base64 source.txt
#deserialize
echo "VGVzdCA6KQo=" | base64 -d >> destination.txt
var pass = prompt().trim();
[].filter.call($('[type=password]'), el => {
let m = el.id.match(/mask\-([0-9]+)/);
return m && m[1];
}).map(el => {
let m = el.id.match(/mask\-([0-9]+)/);
let n = +m[1];
//el.value = pass.charAt(n-1);
console.log(n, pass.charAt(n-1));
});

Keybase proof

I hereby claim:

  • I am gkucmierz on github.
  • I am gkucmierz (https://keybase.io/gkucmierz) on keybase.
  • I have a public key ASCDe9c1wBpEz2mdDTaJzGmIz6FfP9iutrzOCdDocJ5UOQo

To claim this, I am signing this object:

// https://github.com/houdini22/javascript_test/blob/master/parking_lot_test/test.js
const solution = (e,l) => {
let s = [e,l].map(s => {
let m = s.match(/(\d+):(\d+)/);
return (+m[1])*60+(+m[2]);
});
return Math.ceil((s[1]-s[0])/60)*4+1;
}