Skip to content

Instantly share code, notes, and snippets.

View TMUniversal's full-sized avatar

TMUniversal

View GitHub Profile
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@DasWolke
DasWolke / microservice bots.md
Last active June 11, 2024 18:16
Microservice bots

Microservice Bots

What they are and why you should use them

Introduction

Recently more and more chatbots appear, the overall chatbot market grows and the platform for it grows as well. Today we are taking a close look at what benefits creating a microservice chatbot on Discord - (a communication platform mainly targeted at gamers) would provide.

The concepts and ideas explained in this whitepaper are geared towards bots with a bigger userbase where the limits of a usual bot style appear with a greater effect

Information about Discord itself

(If you are already proficient with the Discord API and the way a normal bot works, you may skip ahead to The Concept)

@nirewen
nirewen / erisPrototypes.js
Last active June 7, 2022 02:10
A list of helpful functions for my Eris bot
let Endpoints = require("eris/lib/rest/Endpoints");
Object.defineProperties(Eris.Client.prototype, {
fetchChannel: {
value: function(channelID) {
return this.requestHandler.request("GET", Endpoints.CHANNEL(channelID), true).then((channel) => {
if (channel.type === 0) {
return new Eris.TextChannel(channel, null, this.options.messageLimit);
} else if (channel.type === 1) {
return new Eris.PrivateChannel(channel, this);
} else if (channel.type === 2) {
@MichaelSimons
MichaelSimons / RetrievingDockerImageSizes.md
Last active July 7, 2024 01:49
Retrieving Docker Image Sizes

Retrieving Docker Image Sizes

There are two metrics that are important to consider when discussing the size of Docker images.

  1. Compressed size - This is often referred to as the wire size. This affects how fast/slow images can be pulled from a registry. This impacts the first run experience on machines where images are not cached.
  2. Uncompressed size - This is often referred to as the size on disk. This affects how much local storage is required to support your Docker workloads.

The example commands shown below will work on Windows, MacOS, and Linux.

How to Measure the Compressed Size

@hyrious
hyrious / nodejs-on-exit.js
Created November 22, 2020 05:04
how to do something before exit in NodeJS
// only works when there is no task running
// because we have a server always listening port, this handler will NEVER execute
process.on("beforeExit", (code) => {
console.log("Process beforeExit event with code: ", code);
});
// only works when the process normally exits
// on windows, ctrl-c will not trigger this handler (it is unnormal)
// unless you listen on 'SIGINT'
process.on("exit", (code) => {