Skip to content

Instantly share code, notes, and snippets.

@remarkablemark
remarkablemark / dispatch-keydown-event.js
Created November 16, 2022 23:31
JavaScript dispatch keydown event programmatically
const KEY_CODE = {
ARROW_DOWN: 40,
BACKSPACE: 8,
ENTER: 13,
};
/**
* Dispatch keydown event.
*
* @param {number} keyCode
@patchthecode
patchthecode / reset_idea_trial.sh
Created June 29, 2021 22:50 — forked from gulrich1/reset_idea_trial.sh
reset intellij trial
#!/bin/sh
#https://github.com/PythonicNinja/jetbrains-reset-trial-mac-osx/blob/master/runme.sh
for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine Rider; do
echo "Closing $product"
ps aux | grep -i MacOs/$product | cut -d " " -f 5 | xargs kill -9
echo "Resetting trial period for $product"
@tanaikech
tanaikech / submit.md
Last active May 7, 2024 07:51
Transposing Slice From (n x m) To (m x n) for golang

Transposing Slice From (n x m) To (m x n) for golang

This is a sample script for transposing slice from (n x m) to (m x n) for golang.

Script :

package main

import "fmt"

func transpose(slice [][]string) [][]string {
@sindresorhus
sindresorhus / esm-package.md
Last active May 7, 2024 07:50
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.
@m-jovanovic
m-jovanovic / .editorconfig
Created June 7, 2023 12:17
Sample editor config with a bunch of rules turned off 😅
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
@giuseppe998e
giuseppe998e / nixos-btrfs-tmpfs.md
Last active May 7, 2024 07:43
Install NixOS with BTRFS and IN-RAM root

Install NixOS with BTRFS and IN-RAM root

1. Format and partition the hard drive

  1. Create the GPT partition table
    • $ parted /dev/sdX mklabel gpt
  2. Create the UEFI FAT32 partition (which will be /dev/sdXY)
    • $ parted /dev/sdX mkpart esp fat32 1MiB 512MiB
    • $ parted /dev/sdX set 1 esp on
    • $ parted /dev/sdX set 1 boot on
  • $ mkfs.fat -F 32 -n UEFI /dev/sdXY
@fnky
fnky / ANSI.md
Last active May 7, 2024 07:40
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@chan-mai
chan-mai / gist:5bab0cc3655151b57bab3cb6363f9871
Last active May 7, 2024 07:40
問題のあるインスタンスをよしなにブロックしてくれるGASsc

スプレッドシートとにらめっこして手動で追加していくのに疲れたので作りました。 GASで動くのでタイムスケジュールを組んであげると幸せになれるかもしれません。

// CHANGE HERE
HOST = "" // サーバーのホスト部を指定  ex) shahu.ski
TOKEN = "" // 権限のあるトークンを指定

// スプシから問題のあるインスタンスのリストを取得
function getData(id, sheetName) {
@h3ssan
h3ssan / JetBrains trial reset.md
Last active May 7, 2024 07:39
Reset all JetBrains products trial in Linux

In some cases, only these lines will work

for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine; do
    rm -rf ~/.config/$product*/eval 2> /dev/null
    rm -rf ~/.config/JetBrains/$product*/eval 2> /dev/null
done

But if not, try these