Skip to content

Instantly share code, notes, and snippets.

const har = require('./poolstamp.json');
const fs = require('fs');
const entries = har.log.entries
.filter(el => el._initiator.type !== 'preflight')
.filter(el => el.request.url.match(/(rack-design|add-racks)/gi))
const entriesJSON = JSON.stringify(entries, null, 2);
SSH_ENV="$HOME/.ssh/environment"
function run_ssh_env {
. "${SSH_ENV}" > /dev/null
}
function start_ssh_agent {
echo "Initializing new SSH agent..."
ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo "succeeded"
@szmeku
szmeku / madridCoworks.js
Created January 15, 2021 22:24
madridCoworks.js
let coworks = require('./coworks.json')
const _ = require('ramda')
const fs = require('fs')
let output = '';
_.pipe(
_.map(
_.over(_.lensProp('tarifas'),
_.pipe(
_.filter(_.propEq('period', 'month')), _.map(_.over(_.lensProp('price'), _.pipe(
from itertools import product
from timeit import timeit
import pandas as pd
# data from https://www.cryptodatadownload.com/data/coinbase/
def profit(n, hPeriod, data):
return (data[n + hPeriod] - data[n]) / data[n]
@szmeku
szmeku / task1.py
Created July 23, 2020 16:10
gradient descent for linear regression to find formula for linear function
# todo: find functions formulas using gradient descent
# todo: check if you have
# t1 answers
# h1 = 1 2
# h2 = 10 20
import numpy as np
features = np.array([
[1, 1, 1, 1],
@szmeku
szmeku / courseraCountHours.js
Last active July 20, 2020 09:57
Coursera - count hours
const minutes = (elem) => Array.from(elem.querySelectorAll('.rc-WeekItemAnnotations'))
.map(e => e.innerText.match(/[0-9]+/)[0])
.map(e => Number(e))
.reduce((a,b) => a+b, 0)
const minutesPerSection = () => Array.from(document.querySelectorAll('.od-lesson-collection-element'))
.map(el => ({
section: el.querySelector('.card-headline-text').textContent,
minutes: minutes(el)
@szmeku
szmeku / fixFBBug.js
Last active July 17, 2020 20:57
fixFBBug.js
window.keys = {};
document.activeElement.addEventListener("keydown",
function(e){
keys[e.keyCode] = true;
console.log(JSON.stringify(keys));
if(keys[32] && keys[18]){
console.log('fafa');
// this could be injected to every page by Safe JS Injector
function sendToKindle(){
// copy here instapaper send to kindle bookmarklet code
}
const button = document.createElement('div');
button.onclick = sendToKindle;
button.style.display= 'block';
button.style.position= 'absolute';
// before
const filterPlatesToCombine = () => keys(
pickBy((val, key) => val.combine === true && isEmpty(val.harvestBarcode), barcodeCombinations))
.map(val => { return {id: `plate-barcode-to-combine-${val}`, name: val} });
// after
const platesWithOptions = [..te kombinacje ktore teraz masz..];
const toSortableItem = v => ({id: `plate-barcode-to-combine-${val}`, name: val});
const barcodesForCombinations = pipe(
#!/bin/sh
docker run -u $(id -u ${USER}):$(id -g ${USER}) --net=host -v `pwd`:`pwd` -w `pwd` -ti --rm node:6.0.1 node "$@"
szmeku@localhost ~ %
#!/bin/sh
docker run -u $(id -u ${USER}):$(id -g ${USER}) --net=host -v `pwd`:`pwd` -w `pwd` -ti --rm node npm "$@"
szmeku@localhost ~ %