Skip to content

Instantly share code, notes, and snippets.

View johnpmitsch's full-sized avatar

John Mitsch johnpmitsch

View GitHub Profile
@jboner
jboner / latency.txt
Last active May 5, 2024 03:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@jlsherrill
jlsherrill / ListenOnCandlepin.md
Last active February 28, 2019 15:24
clearing ListenOnCandlepin Events

Shut down foreman-tasks:

  service foreman-tasks stop

Open the rails console:

foreman-rake console
@subfuzion
subfuzion / curl.md
Last active May 5, 2024 10:49
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@citrusui
citrusui / dropdown.md
Last active April 21, 2024 18:44
"Dropdowns" in Markdown
How do I dropdown?
This is how you dropdown.

<details>
<summary>How do I dropdown?</summary>
<br>
This is how you dropdown.
@albertorestifo
albertorestifo / propdiff.js
Created April 12, 2017 15:55
Logs the diff between current and previous props on a react element
componentDidUpdate(prevProps) {
console.log('Rrow update diff:');
const now = Object.entries(this.props);
const added = now.filter(([key, val]) => {
if (prevProps[key] === undefined) return true;
if (prevProps[key] !== val) {
console.log(`${key}
- ${JSON.stringify(val)}
@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

@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 2, 2024 16:19
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
@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

@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 => {