Skip to content

Instantly share code, notes, and snippets.

View amirilovic's full-sized avatar

Aleksandar Mirilovic amirilovic

  • adidas
  • Nuremberg, Germany
View GitHub Profile
@amirilovic
amirilovic / take-memory-snapshot.ts
Created July 15, 2024 20:46
A script that takes a heap snapshot from a nodejs process in debug mode
const { exec, spawn } = require("child_process");
const fs = require("fs");
const { promisify } = require("util");
import { WebSocket } from "ws";
async function getWebSocketDebuggerUrl() {
const res = await fetch("http://localhost:9229/json");
const data = await res.json();
return data[0].webSocketDebuggerUrl;
}
# Create a new package
$ mkdir test-esm
$ cd test-esm
$ npm init -y
# make sure you are using Node 14+
# if you don't have nvm, check this out https://github.com/nvm-sh/nvm#install--update-script
$ nvm install 14
# install react and react-dom
// importing dependencies
import React from "react";
// exporting
export default function Title({ text }) {
return React.createElement("h1", null, text);
}
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(["react"], factory);
} else if (typeof exports === "object") {
module.exports = factory(require("react"));
} else {
root.Title = factory(root.React);
}
}(this, function (React) {
return function Title({ text }) {
// importing dependencies
const React = require('react');
//exporting
module.exports = function Title({ text }) {
return React.createElement('h1', null, text)
};
// importing dependencies
define(['react'], function (React) {
// exporting
return function Title({ text }) {
return React.createElement('h1', null, text)
};
});
## Delete word
Keyboard Shortcut: ⌥⌫
Action: Send Hex Code
Code: 0x17
## Delete line
Keyboard Shortcut: ⌘⌫
Action: Send Hex Code
Code: 0x15
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install zsh
brew install --cask iterm2
brew install --cask rectangle
brew install fzf
$(brew --prefix)/opt/fzf/install
brew install go
brew install jq
brew install kubectl
@amirilovic
amirilovic / docker-compose.yml
Created September 7, 2019 23:37
redis docker compose
version: "3"
services:
redis:
image: redis
ports:
- "6379:6379"
restart: always

Keybase proof

I hereby claim:

  • I am amirilovic on github.
  • I am amirilovic (https://keybase.io/amirilovic) on keybase.
  • I have a public key ASCqSYZ63syLfh1dcosLNTj3u_sWoRGV6RXF8wbWdTrXgwo

To claim this, I am signing this object: