Skip to content

Instantly share code, notes, and snippets.

View Yoshyn's full-sized avatar
🇫🇷
Graou

Sylvestre Antoine Yoshyn

🇫🇷
Graou
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active May 24, 2024 02:36
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@tallclair
tallclair / git-repo-demo.yaml
Created March 9, 2018 19:54
More secure GitRepo volumes
# Example of using an InitContainer in place of a GitRepo volume.
# Unilke GitRepo volumes, this approach runs the git command in a container,
# with the associated hardening.
apiVersion: v1
kind: Pod
metadata:
name: git-repo-demo
annotations:
seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
spec:
@agibralter
agibralter / inherited.rb
Last active August 3, 2023 10:34
Trying to figure out how to properly `include` an `inherited` hook
module Hook
def self.included(base)
# base.extend ClassMethods
base.class_eval do
# def self.inherited(baseclass)
# # super
# puts "1 #{baseclass.to_s}"
@sjednac
sjednac / BusyApp.java
Last active May 11, 2021 07:03
JVM monitoring in a Docker environment
public final class BusyApp {
public static void main(String []args) throws Exception {
final java.util.Random generator = new java.util.Random();
while (true) {
generator.ints(1000000, 0, 100).sorted();
Thread.sleep(5000L);
}
}
}
@wvengen
wvengen / README.md
Last active March 25, 2024 07:53
Ruby memory analysis over time

Finding a Ruby memory leak using a time analysis

When developing a program in Ruby, you may sometimes encounter a memory leak. For a while now, Ruby has a facility to gather information about what objects are laying around: ObjectSpace.

There are several approaches one can take to debug a leak. This discusses a time-based approach, where a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up. Afterwards, one can look at all the objects, and find out which ones are staying around, causing the