Skip to content

Instantly share code, notes, and snippets.

@paulirish
paulirish / intro-overhead-of-performance.mark.md
Last active April 2, 2024 16:50
Evaluating overhead of performance.mark()

A few conversations have circled around user-side structural profiling. For context, see React PR #7549: Show React events in the timeline when ReactPerf is active

One particular concern is the measurement overhead. This gist has a benchmarking script (measure.js) for evaluating overhead and initial results.

Results: performance.mark()

Runs about 0.65µs per mark() call. Naturally, that's ~= an overhead of 1ms for 1500 mark()s. image

@stefansundin
stefansundin / extract-attachments.py
Last active September 27, 2022 18:54
Extract attachments from emails that Gmail doesn't allow you to download. This is dumb. Please use Python >= 3.4.
#!/usr/bin/env python3
# Get your files that Gmail block. Warning message:
# "Anti-virus warning - 1 attachment contains a virus or blocked file. Downloading this attachment is disabled."
# Based on: https://spapas.github.io/2014/10/23/retrieve-gmail-blocked-attachments/
# Instructions:
# Go to your emails, click the arrow button in the top right, "Show original", then "Download Original".
# Move the files to the same directory as this program, then run it.
import sys
anonymous
anonymous / OPVOQz.markdown
Created November 26, 2014 10:01
OPVOQz
@rf
rf / convert.js
Last active May 20, 2016 18:15
Symbolicate linux perf output of a node program using the v8 log
var fs = require('fs');
var infile = process.argv[2];
if (!infile) return console.log("need infile");
var data = fs.readFileSync(infile, 'utf8').split('\n');
var outlines = [];
data.forEach(function(item) {
@heyalexej
heyalexej / install-charles-proxy.sh
Last active July 26, 2024 07:05
install charles proxy from deb source
#!/usr/bin/env sh
set -e
# install charles proxy from deb sources.
# http://www.charlesproxy.com
sudo sh -c 'echo "deb http://www.charlesproxy.com/packages/apt/ charles-proxy main" > /etc/apt/sources.list.d/charles-proxy.list'
wget -q http://www.charlesproxy.com/packages/apt/PublicKey -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y charles-proxy
@jodaka
jodaka / gist:f4d5998e6faaf97075ca
Created May 12, 2014 15:07
Webkit cookies proxy for android-async-http
/**
* We need dummy cookie storage that wouldn't save any cookies
* or get any cookies
*/
public class WebkitCookietHandlerProxy extends CookieHandler {
@Override
public void put(URI uri, Map<String, List<String>> responseHeaders) throws IOException {
if (uri == null || responseHeaders == null) {
@trevnorris
trevnorris / perf-flame-graph-notes.md
Last active May 25, 2026 19:26
Quick steps of how to create a flame graph using perf

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
@dkandalov
dkandalov / plugin.groovy
Last active January 15, 2025 11:51
Example of listening to VCS updates in IntelliJ (this is mini-plugin for https://github.com/dkandalov/live-plugin)
import com.intellij.openapi.module.ModuleManager
import com.intellij.openapi.util.Pair
import com.intellij.openapi.vcs.ProjectLevelVcsManager
import com.intellij.openapi.vcs.VcsKey
import com.intellij.openapi.vcs.update.UpdateEnvironment
import com.intellij.openapi.vcs.update.UpdatedFilesListener
import com.intellij.openapi.vcs.update.UpdatedFilesReverseSide
import com.intellij.util.Consumer
import com.intellij.util.messages.MessageBusConnection
@happysundar
happysundar / setup port forwarding to enable remote debugging in vagrant vm.md
Created January 30, 2014 07:36
Getting the remote debugger to work with a java process running in a vagrant vm

Vagrant vm network config

In the Vagrantfile, do :

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  config.vm.network :public_network
From 8e3070ad5cc17116e47f71290d86b83aa06e98eb Mon Sep 17 00:00:00 2001
From: Timothy J Fontaine <tj.fontaine@joyent.com>
Date: Tue, 12 Aug 2014 00:20:44 +0000
Subject: [PATCH 2/2] descriptions are also 4 byte aligned
---
usr/src/lib/libproc/common/Pcore.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/usr/src/lib/libproc/common/Pcore.c b/usr/src/lib/libproc/common/Pcore.c