Skip to content

Instantly share code, notes, and snippets.

View jlisee's full-sized avatar

Joseph Lisee jlisee

  • Glydways
  • Falls Church, VA
  • 19:05 (UTC -04:00)
  • LinkedIn in/jlisee
View GitHub Profile
@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

anonymous
anonymous / foo.cpp
Created September 2, 2016 06:59
emscripten webgl 2 errors
#define GL_GLEXT_PROTOTYPES
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES3/gl3.h>
#include <stdio.h>
#include <emscripten.h>
#include <emscripten/html5.h>
#define GL_CALL( x ) \
{ \
@Alexhuszagh
Alexhuszagh / embed_file.py
Created August 5, 2016 15:01 — forked from jlisee/embed_file.py
Convert a file to a C file to embedding in a C/C++ program
#! /usr/bin/env python
# Copyright (c) 2014, Joseph Lisee
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
@itchix
itchix / leek_wars.py
Created April 13, 2016 13:57
leek wars auto fight python
import json
import requests
login = ''
passwd = ''
# connexion
r = requests.post("http://leekwars.com/api/farmer/login-token", data={'login': login, 'password':passwd})
token = r.json()['token']
@bearfrieze
bearfrieze / comprehensions.md
Last active December 23, 2023 22:49
Comprehensions in Python the Jedi way

Comprehensions in Python the Jedi way

by Bjørn Friese

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

@VictorLaskin
VictorLaskin / NamedTuple.h
Last active April 14, 2023 18:56
Named tuple for C++
// Named tuple for C++
// Example code from http://vitiy.info/
// Written by Victor Laskin ([email protected])
// Parts of code were taken from: https://gist.github.com/Manu343726/081512c43814d098fe4b
namespace foonathan {
namespace string_id {
namespace detail
{
@GrantTrebbin
GrantTrebbin / QRBackup.sh
Last active January 19, 2025 02:57
How to encode and decode a file backed up as a series of printed QR codes
# How to encode and decode a file backed up as a series of printed QR codes
# Install the required tools
sudo apt-get update
sudo apt-get install zbar-tools imagemagick qrencode
################################################################################
# Convert the file to a base 64 encoded format. Probably not needed as QR codes
# Type(<scope>): <subject>
# <body>
# <footer>
# Type should be one of the following:
# * feat (new feature)
# * fix (bug fix)
# * docs (changes to documentation)
@lukechampine
lukechampine / a.c
Created October 19, 2014 01:00
a.c (with a.h expanded)
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sys/mman.h>
typedef void V;typedef int I;typedef double F;typedef unsigned char C,*S;typedef long L;
#define O printf
#define R return
#define I(a...) if(a)
#define W(a...) while(a)
@BloodAxe
BloodAxe / Eigen2CV.h
Created August 16, 2014 19:43
This header file contains code snippet for easy mapping Eigen types to OpenCV and back with minimal overhead.
/**
* @brief Mapping functions from Eigen data types to OpenCV
* @author Eugene Khvedchenya <[email protected]>
* @details This header file contains code snippet for easy mapping Eigen types to OpenCV and back with minimal overhead.
* @more computer-vision.talks.com/articles/mapping-eigen-to-opencv/
* Features:
* - Mapping plain data types with no overhead (read/write access)
* - Mapping expressions via evaluation (read only acess)
*
* Known issues: