Skip to content

Instantly share code, notes, and snippets.

View johnpmitsch's full-sized avatar

John Mitsch johnpmitsch

View GitHub Profile
@johnpmitsch
johnpmitsch / sdk.ts
Last active August 3, 2023 16:06
QuickNode SDK snippet: get NFTs for a wallet
// 1. Go to https://auth.quicknode.com/signup
// 2. Spin up ethereum, sepolia, or polygon endpoint and add Token/NFT RPC API v2 add-on
// 3. npm/yarn install @quicknode/sdk in typescript or javascript project
// 4. Copy and paste code in project and replace endpointUrl and wallet value below
// 5. profit!
import Core from "@quicknode/sdk/core";
(async () => {
const core = new Core({
data:text/html,<html> <script type="module"> import { API } from 'https://esm.sh/@quicknode/sdk'; const qn = new API(); document.body.innerText = (JSON.stringify(await qn.tokens.getBalancesByWallet({ address: "quicknode.eth" }))); </script></html>
@johnpmitsch
johnpmitsch / a.diff
Created February 5, 2021 14:54
pf 4 error diff
diff --git a/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js b/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js
index 6b7e4eb..bb6b6f6 100644
--- a/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js
+++ b/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js
@@ -37,7 +37,6 @@ import RepoIcon from './RepoIcon';
import SelectableDropdown from '../../../../components/SelectableDropdown';
import { capitalize } from '../../../../utils/helpers';
-
const allRepositories = 'All repositories';
@johnpmitsch
johnpmitsch / w.md
Last active June 28, 2021 21:05
Katello dev server hacky wepback workaround

go to node_modules/webpack-dev-server/lib/Server.js in ~/foreman

around line 496 change protocols: ['h2', 'http/1.1'] to protocols: ['http/1.1'] (remove h2 from the array)

start dev server

NOTE: this will be overwritten when you npm install again

@johnpmitsch
johnpmitsch / a.md
Last active June 25, 2024 17:10
Bradfield CS Distributed Systems

Distributed Systems

Lesson 1 - Introduction

  • Systems today are generally distributed, both in-house and third-party systems
  • Stream processing is batch processing but in smaller increments, it isn't real-time, but is quick
  • Project, work as pre and post work
  • Reliability
  • Scalability
  • Maintainability
@johnpmitsch
johnpmitsch / a.md
Last active August 29, 2020 15:26
Bradfield CS database notes

Databases

Indexing

  • B+ trees are always best, but ISAM came first, ISAM is a simpler way to start learning
  • Each node is a page on disk and has a pointer to the related parts, 'block 7'
  • B+ tree, only leaf nodes matter, the rest are to direct traffic
  • binary search is really difficult, it is reads on disk, so instead of this we use an "index" file that stores key values with pointers to pages
  • B+ tree is height-balanced.
  • each node has 50% pointers on them because pages will be split in half to make space
error
```
2020-08-10 14:51:58 UTC ERROR: subquery has too many columns at character 79
2020-08-10 14:51:58 UTC STATEMENT: SELECT COUNT(*) FROM "katello_repositories" WHERE "katello_repositories"."id" IN (SELECT DISTINCT katello_repositories.*,
CASE
WHEN katello_content_view_repositories.content_view_id = 4 THEN 1
ELSE 0
END AS "added_to_content_view"
, "katello_repositories"."id" FROM katello_repositories LEFT JOIN katello_content_view_repositories ON (katello_repositories.id = katello_content_view_repositories.repository_id) LEFT JOIN katello_content_views ON (katello_content_view_repositories.content_view_id = katello_content_views.id) WHERE ( katello_content_views.id = 4 OR katello_content_views.id IS NULL
) ORDER BY added_to_content_view DESC, katello_repositories.id
@johnpmitsch
johnpmitsch / a.diff
Created July 8, 2020 19:55
r-t-lib refactor
diff --git a/webpack/test-utils/react-testing-lib-wrapper.js b/webpack/test-utils/react-testing-lib-wrapper.js
index 7562bc4..c3a023f 100644
--- a/webpack/test-utils/react-testing-lib-wrapper.js
+++ b/webpack/test-utils/react-testing-lib-wrapper.js
@@ -22,8 +22,9 @@ process.env.DEBUG_PRINT_LIMIT = 99999;
function renderWithRedux(
component,
{
- namespace, // redux namespace
- initialState = { response: {}, status: STATUS.PENDING },
@johnpmitsch
johnpmitsch / steps.md
Last active June 4, 2020 02:15
Set up ubuntu for katello test env
  • Install ruby
sudo snap install ruby --classic
sudo snap switch ruby --channel=2.3/stable
sudo snap refresh
  • Install system deps: sudo apt-get install libsystemd-dev make postgresql git ruby-libvirt build-essential patch ruby-dev zlib1g-dev liblzma-dev libxml2-dev libcurl4-openssl-dev libpq-dev
  • sudo apt install qemu-kvm libvirt-daemon-system libvirt-dev (some might not be needed)
  • sudo apt install nodejs needs a JS runtime for some reason
  • git clone foreman + katello (as siblings)
@johnpmitsch
johnpmitsch / os.md
Created May 13, 2020 00:38
Operating System course

Operating System

Introduction to OS