Skip to content

Instantly share code, notes, and snippets.

// Minesweeper generator for Discord messages. Idea and emotes were peeped from SKrshe and kjagodka.
// How to use:
// Paste this code into browser's console and press Enter (it will put message with game into clipboard).
// Paste and post message in Discord.
// You can change width, height and number of mines.
// But Discord has limit of number of emotes: 199 - (number of spoilers). So 10 by 10 field is impossible.
const width = 11
const height = 9
let numberOfMines = 17
if (width * height > 99) throw new Error("Field is too big! Please, make width or height smaller.")
@kolumb
kolumb / Porth.sublime-syntax
Last active January 18, 2022 09:45
Syntax highlighting for Porth (https://gitlab.com/tsoding/porth) in Sublime Text
%YAML 1.2
---
# See http://www.sublimetext.com/docs/syntax.html
name: Porth
scope: source.porth
file_extensions:
- porth
variables:
char_escape: '\\n|\\r|\\\\|\\"|\\'''
@kolumb
kolumb / logging.js
Last active September 5, 2022 23:13
Node.js Raw Request and IP Log Script
const http = require('http');
const fs = require('fs');
// const os = require('os');
// console.log(os.networkInterfaces())
// const net = require('net');
// console.log(net.isIP("123.123.123.333"))
// http://localhost:8000/echo/server/index.php?what=is&this=donno
// fetch("127.0.0.1:8000/api/endpoint/",{method: "POST", body:"text"}).then(data=>data.text().then(console.log))
// https://canyouseeme.org/
@kolumb
kolumb / build.bat
Last active February 8, 2021 04:52
Build.bat that recompiles only changed source files
@echo off
rem Find and launch x64 Native Tools Command Prompt if needed
if not defined DevEnvDir (
if "%VSWHERE%"=="" set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
)
if not defined DevEnvDir (
for /f "usebackq tokens=*" %%i in (`call "%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
set InstallDir=%%i
)
/*
* Midikeys.js
* > Turn your keyboard into a midi keyboard, compatible with the Web MIDI API.
* Copyright 2012 Nick Thompson
* MIT License
* https://gist.github.com/3995530
*/
(function (window, document, undefined) {
// Keycode to MIDI note values