Skip to content

Instantly share code, notes, and snippets.

View TomaszWaszczyk's full-sized avatar
🔑
Between cyber, number puzzles, war and Bible.

Tomasz Waszczyk TomaszWaszczyk

🔑
Between cyber, number puzzles, war and Bible.
View GitHub Profile
@TomaszWaszczyk
TomaszWaszczyk / Eyeballing-This.md
Created February 12, 2019 08:12 — forked from zcaceres/Eyeballing-This.md
Understanding Binding and 'this' in Javascript

How to Eyeball Your ‘This’ Context in Javascript

The early programmer struggles with the Javascript keyword this. But understanding your this context is easier than it seems.

This is all about where a function is invoked. Often, early programmers worry about where the function was declared. Perhaps the function was declared in a specific file or a particular object. Surely this changes it's this!

Nope.

To understand this, we need to see where it is invoked. Nothing else matters, with one exception which we'll cover in a moment.

@TomaszWaszczyk
TomaszWaszczyk / enzyme_render_diffs.md
Created August 6, 2019 15:30 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@TomaszWaszczyk
TomaszWaszczyk / gist:e2264b0207acedbadd168e34f865917b
Created April 1, 2020 07:40 — forked from atcuno/gist:3425484ac5cce5298932
HowTo: Privacy & Security Conscious Browsing

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.

Table of Contents

#!/bin/bash
get_latest_release () {
curl --silent "https://api.github.com/repos/paritytech/polkadot/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
V=`get_latest_release`
SERVICE="polkadot-validator"
@TomaszWaszczyk
TomaszWaszczyk / superpolynomial.txt
Created April 12, 2021 20:55 — forked from rietta/superpolynomial.txt
Memorize the RSA encryption algorithm as a song! This is a mirrored copy of the RSA, Superpolynomial song which has become hard to find on the Internet.
These original sources are now no longer available:
- http://www.xent.com/FoRK-archive/oct00/0429.html
- http://www.cryptorights.org/events/2000/superpolynomial.html
For a 2000 example of how to use this song in a lecture format, see http://permalink.gmane.org/gmane.comp.encryption.general/4856 by Eric Hughes.
To the tune of Mary Poppins:
Superpolynomial subexponential runtimes.
Even though in practice it would take you several lifetimes,
@TomaszWaszczyk
TomaszWaszczyk / index.js
Created June 13, 2021 12:07 — forked from shawntabrizi/kusama.js
unlocking data on substrate
var { ApiPromise, WsProvider } = require('@polkadot/api');
var { BN_ZERO } = require('@polkadot/util');
async function main() {
const provider = new WsProvider("wss://kusama-rpc.polkadot.io/", false);
provider.connect();
const api = await ApiPromise.create({ provider });
// Get general information about the node we are connected to
const [chain, nodeName, nodeVersion] = await Promise.all([
#![feature(prelude_import)]
#![no_std]
// Copyright 2017-2019 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
@TomaszWaszczyk
TomaszWaszczyk / installing-node-with-nvm.md
Created August 11, 2021 14:49 — forked from d2s/installing-node-with-nvm.md
Installing Node.js to Linux & macOS & WSL with nvm

Installing Node.js with nvm to Linux & macOS & WSL

A quick guide on how to setup Node.js development environment.

Install nvm for managing Node.js versions

nvm allows installing several versions of Node.js to the same system. Sometimes applications require a certain versions of Node.js to work. Having the flexibility of using specific versions can help.

  1. Open new Terminal window.
// USAGE EXAMPLE
render() {
const { currentUserState, nearEnv } = this.state;
return currentUserState.match({
notAsked: () => <HomePage />,
loading: () => <HomePage />,
failure: (err) => <>Error occurred</>,
success: (user) => <AppRouter currentUser={user} nearEnv={nearEnv} />,
@TomaszWaszczyk
TomaszWaszczyk / zshrc
Created September 11, 2021 12:05 — forked from LukeSmithxyz/zshrc
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history