Skip to content

Instantly share code, notes, and snippets.

@mtsmfm
mtsmfm / foo.mjs
Last active December 12, 2023 04:29
NextJS memory issue
import { createServer } from "http";
import { Writable } from "node:stream";
import { createWriteStream } from "node:fs";
const prettyMemoryUsage = (mem) => {
const formattedMemory = Object.entries(mem).map(([key, value]) => {
const formattedValue = (value / 1024 / 1024).toFixed(2);
return `${key}: ${formattedValue} MB`;
});
import React, { useMemo } from "react";
import { CylinderGeometry } from "three";
export const CurvedPlane = ({
width,
height,
radius,
children,
}: {
width: number;
@mtsmfm
mtsmfm / foo.rb
Created September 1, 2022 09:11
before_action with inheritance with opposite option
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "rails"
gem "pry-byebug"
end
require "rack/test"
@mtsmfm
mtsmfm / foo.sh
Created May 11, 2022 09:38
graceful shutdown with child process
trap 'kill "${child_pid}"; wait ${child_pid}; exit' TERM INT
ruby -e 'at_exit { sleep 3; p "exit" }; loop { p "sleep"; sleep 1 }' &
child_pid="$!"
sleep infinity & wait
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'pry-byebug'
gem 'activesupport', require: %w[active_support active_support/core_ext/hash]
end
require "open3"
@mtsmfm
mtsmfm / Gemfile
Last active November 30, 2021 03:27
Bundler 2.2.32 bug
source "https://rubygems.org"
gem "testgem", path: "."
@mtsmfm
mtsmfm / plugin.yaml
Last active September 16, 2021 07:13
My che-theia
apiVersion: v2
publisher: eclipse
name: che-theia
version: next
type: Che Editor
displayName: theia-ide
title: Eclipse Theia development version.
description: 'Eclipse Theia, get the latest release each day.'
icon: /images/default.png
category: Editor
@mtsmfm
mtsmfm / plugin.yaml
Last active September 1, 2021 14:59
rust-analyzer
apiVersion: v2
publisher: matklad
name: rust-analyzer
version: latest
type: VS Code extension
displayName: Rust Analyzer
title: Rust Analyzer
description: Rust Analyzer
icon: https://github.com/rust-analyzer/rust-analyzer/raw/master/assets/logo-square.svg
category: Programming Languages
@mtsmfm
mtsmfm / README.md
Last active August 10, 2021 15:22
Install eclipse che on docker desktop
$ kubectl apply -f https://gist.githubusercontent.com/mtsmfm/7d582a83f2c963273612d6dcd8f856c1/raw/6ebaff9d92a062d7cb886ff22bcad57c36f6f1cf/coredns-configmap.yaml
$ kubectl patch deployment coredns -n kube-system --patch "$(curl https://gist.githubusercontent.com/mtsmfm/7d582a83f2c963273612d6dcd8f856c1/raw/6ebaff9d92a062d7cb886ff22bcad57c36f6f1cf/coredns-deployment-patch.yaml)"
$ chectl server:deploy --platform=docker-desktop --domain che.127.0.0.1.nip.io
@mtsmfm
mtsmfm / a.rb
Last active September 9, 2021 09:05
Find not used Rails endpoints via BigQuery
require 'bundler/inline'
gemfile do
eval File.read(File.join(__dir__, 'Gemfile'))
gem 'js_regex'
gem 'pry-byebug'
end
require_relative 'config/environment'