Skip to content

Instantly share code, notes, and snippets.

@sindresorhus
sindresorhus / esm-package.md
Last active May 7, 2024 08:55
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.
@ftclausen
ftclausen / Jenkinsfile
Created April 13, 2017 05:36
Jenkins pipeline - An approach to get all commits since the last successful build.
// -*- mode: groovy -*-
// vim: set filetype=groovy :
node( 'some_node' ) {
stage( "Phase 1" ) {
sshagent( credentials: [ 'some_creds' ] ) {
checkout scm
def lastSuccessfulCommit = getLastSuccessfulCommit()
def currentCommit = commitHashForBuild( currentBuild.rawBuild )
if (lastSuccessfulCommit) {
@aiexz
aiexz / api.txt
Last active May 7, 2024 08:52
Shodan API keys
OefcMxcunkm72Po71vVtX8zUN57vQtAC
PSKINdQe1GyxGgecYz2191H2JoS9qvgD
pHHlgpFt8Ka3Stb5UlTxcaEwciOeF2QM
61TvA2dNwxNxmWziZxKzR5aO9tFD00Nj
xTbXXOSBr0R65OcClImSwzadExoXU4tc
EJV3A4Mka2wPs7P8VBCO6xcpRe27iNJu
mEuInz8UH1ixLGJq4oQhEiJORERVG5xc
lkY0ng0XMo29zEhzyw3ibQfeEBxghwPF
syeCnFndQ8TE4qAGvhm9nZLBZOBgoLKd
7TeyFZ8oyLulHwYUOcSPzZ5w3cLYib61
@Dounm
Dounm / monitor_ib_traffic.py
Last active May 7, 2024 08:52
Monitor Infiniband traffic and caculate bandwidth
# Inspired by https://github.com/vpenso/ganglia-sensors/blob/master/lib/python_modules/infiniband.py#/
import logging
import re
import sys
import json
import time
import subprocess
@dblalock
dblalock / align.c
Created August 30, 2017 22:11
C / C++ portable aligned memory allocation
/* Allocate aligned memory in a portable way.
*
* Memory allocated with aligned alloc *MUST* be freed using aligned_free.
*
* @param alignment The number of bytes to which memory must be aligned. This
* value *must* be <= 255.
* @param bytes The number of bytes to allocate.
* @param zero If true, the returned memory will be zeroed. If false, the
* contents of the returned memory are undefined.
* @returns A pointer to `size` bytes of memory, aligned to an `alignment`-byte
@Kaundur
Kaundur / canvasDownload.js
Created June 8, 2017 07:25
JS to automatically download canvas as a png
// This code will automatically save the current canvas as a .png file.
// Its useful as it can be placed in a loop to grab multiple canvas frames, I use it to create thumbnail gifs for my blog
// Only seems to work with Chrome
// Get the canvas
var canvas = document.getElementById("canvas");
// Convert the canvas to data
var image = canvas.toDataURL();
// Create a link
var aDownloadLink = document.createElement('a');
@ScottJWalter
ScottJWalter / .asoundrc
Last active May 7, 2024 08:47
Jabra 410/510 on Picroft (Mycroft on Raspberry Pi)
pcm.jabra {
type hw
card 1
device 0
rate 48000
}
pcm.!sysdefault {
type asym
playback.pcm {
type plug
@2minchul
2minchul / example.py
Created January 18, 2019 03:50
A simple example of tenacity with aiohttp
import asyncio
import random
import logging
import aiohttp
import tenacity
logging.basicConfig(level=logging.DEBUG)
@ntamvl
ntamvl / Increasing-the-amount-of-inotify-watchers.md
Created August 16, 2017 03:10
Increasing the amount of inotify watchers

Increasing the amount of inotify watchers

If you are not interested in the technical details and only want to get Listen to work:

  • If you are running Debian, RedHat, or another similar Linux distribution, run the following in a terminal:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@williamd1k0
williamd1k0 / EditorIconTexture.gd
Created May 6, 2024 23:46
Helper Texture class to use Godot Editor icons in plugins, such as main screen plugins.
@tool
class_name EditorIconTexture
extends AtlasTexture
var icon :String:
set(val):
icon = val
_update_icon.call_deferred()
func _init():