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({
@jturel
jturel / gist:317e9f892fb19e84480880f1f674e74e
Last active February 11, 2022 16:21
SubscriptionFacetPools
# create a new organization $MYORG
org = Organization.find_by_name($MYORG)
hosts = []
50000.times { hosts << { name: SecureRandom.uuid, organization_id: org.id } }
host_ids = ::Host::Managed.import(hosts, validate: false).ids
facets = host_ids.map { |id| { host_id: id } }
facet_ids = Katello::Host::SubscriptionFacet.import(facets, validate: false).ids
pushd .
FILES=$(find test -type f -path "*$1*"|tr '\n' ' ')
echo $FILES
bundle exec ruby -Itest $FILES
popd
@iNecas
iNecas / $*_vs_$@
Last active August 15, 2018 13:46
Difference between $* and "$@"
./test_args.sh "one two" three
with $*
["one", "two", "three"]
with "$@"
["one two", "three"]
This is a basic example of using SOCKS.
From the computer you want to browse on you'll make an ssh connection to the computer you want to browse from.
In this example it'll be my laptop connecting to my desktop.
Run: ssh -D <port, I use 10000> <user>@<hostname of desktop>
Now, in a browser you don't normally use (I'm using firefox), go to network proxy.
Set Manual porxy configuration
@johnpmitsch
johnpmitsch / regenerate_subscription_queues.txt
Created November 13, 2017 16:46 — forked from jlsherrill/regenerate_subscription_queues.txt
Re-generate candlepin event queues
CERT=/etc/pki/katello/certs/katello-apache.crt
KEY=/etc/pki/katello/private/katello-apache.key
#create exchange:
qpid-config --ssl-certificate $CERT --ssl-key $KEY -b "amqps://localhost:5671" add exchange topic event --durable
#view exchange:
qpid-config --ssl-certificate $CERT --ssl-key $KEY -b "amqps://localhost:5671" exchanges
#create queue:
qpid-config --ssl-certificate $CERT --ssl-key $KEY -b 'amqps://localhost:5671' add queue katello_event_queue --durable
@sorenlouv
sorenlouv / determine-changed-props.js
Last active April 18, 2024 16:21
Determine which props causes React components to re-render
import React, { Component } from 'react';
export default function withPropsChecker(WrappedComponent) {
return class PropsChecker extends Component {
componentWillReceiveProps(nextProps) {
Object.keys(nextProps)
.filter(key => {
return nextProps[key] !== this.props[key];
})
.map(key => {
@johnpapa
johnpapa / DockerCleanupScripts.md
Created August 3, 2017 01:37 — forked from spboyer/DockerCleanupScripts.md
Docker Cleanup Scripts

Docker - How to cleanup (unused) resources

Cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active April 23, 2024 15:35
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@jlsherrill
jlsherrill / minitest_bisect.md
Last active October 11, 2019 14:38
using minitest-bisect with foreman/katello/plugins or really any rails project

Using minitest-bisect to debug tranient test failures

When to use?

  1. You have a test that is failing occasionally locally or in jenkins
  2. It doesn't fail when you run just one test, it requires the entire test suite to run

How to use minitest-bisect

Note that many of these instructions will be katello specific, but will work with slight modifications for foreman or other rails projects.

1. Find a failing seed number