Skip to content

Instantly share code, notes, and snippets.

@sindresorhus
sindresorhus / esm-package.md
Last active May 4, 2024 15:48
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.
@csereno
csereno / CloudWatchAgentConfig.json
Created October 1, 2018 20:35
AWS CloudWatch Agent configuration file example for Linux with standard /var/log/messages, secure, and yum logs
{
"agent": {
"metrics_collection_interval": 10,
"logfile": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log"
},
"metrics": {
"metrics_collected": {
"cpu": {
"resources": [
"*"
@MRobertEvers
MRobertEvers / Python_Import_Other_Directories.md
Created May 6, 2018 19:41
Import Python Files From Another Directory Python 3

Import Python Files From Another Directory

I've come across various ways to include files from other directories in python. At this time, none of my python projects have ever scaled enough to warrant a nice directory structure but I find this information useful to know.

Module Search

The Python Docs 6.1.4 explain nicely what happens when you try to import a module.

When a module named spam is imported, the interpreter first searches for a built-in module with that name. If not found, it then searches for a file named spam.py in a list of directories given by the variable sys.path. sys.path is initialized from these locations:
- The directory containing the input script (or the current directory when no file is specified).
- PYTHONPATH (a list of directory names, with the same syntax as the shell variable PATH).
  • The installation-dependent default.
@josephhanson
josephhanson / MockFile.js
Last active December 12, 2023 16:51
Mock file for JavaScript based file upload - with basic test harness
// mock file
function MockFile() { };
MockFile.prototype.create = function (name, size, mimeType) {
name = name || "mock.txt";
size = size || 1024;
mimeType = mimeType || 'plain/txt';
function range(count) {
var output = "";
@evantoli
evantoli / GitConfigHttpProxy.md
Last active April 26, 2024 17:21
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@dlfinis
dlfinis / examples-sed
Last active March 3, 2024 04:01
Examples of Sed' Use
The syntax of sed command replacement is:
$ sed 's/find/replace/' file
This sed command finds the pattern and replaces with another pattern. When the replace is left empty, the pattern/element found gets deleted.
Let us consider a sample file as below:
$ cat file
Linux
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active April 13, 2024 16:19
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@rxaviers
rxaviers / gist:7360908
Last active May 5, 2024 06:01
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: