Skip to content

Instantly share code, notes, and snippets.

View MarketingPip's full-sized avatar
🚬
🌳

Jared Van Valkengoed MarketingPip

🚬
🌳
View GitHub Profile
@pocco81
pocco81 / os.capture
Created September 15, 2021 03:12 — forked from dukeofgaming/os.capture
Capture console output from Lua system call
---
-- Function to retrieve console output
--
function os.capture(cmd, raw)
local handle = assert(io.popen(cmd, 'r'))
local output = assert(handle:read('*a'))
handle:close()
if raw then
@ritwickdey
ritwickdey / infinite-loop-detection.js
Last active November 21, 2023 12:54
Infinite loop detection via AST transformation
export default function (babel) {
const { types: t } = babel;
const infiniteLoopDetector = babel.parse(`
function __infiniteLoopDetector() {
loopdetector.count += 1;
if(loopdetector.count > 10000) {
throw new Error("Infinte loop detected.")
@nberlette
nberlette / xterm-256color.svg
Last active October 1, 2024 02:33 — forked from jasonm23/xterm-256color.svg
xterm-256color codes chart, in sections.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mob-sakai
mob-sakai / _README.md
Last active April 26, 2025 15:26
Run shell script on gist

Run shell script on gist

Shells that support process substitution such as bash and zsh allow to run shell script on gist as follows.

# With curl:
bash <(curl -sL ${GIST_URL}) args...

# With wget:
@dominikwilkowski
dominikwilkowski / README.md
Last active July 10, 2025 22:04
ANSI codes for cli controled output

ANSI escape sequences

ANSI escape sequences can be printed to a shell to as instructions. The below is a list of codes I have used often in my CLI programs and I find myself looking up over and over again.

A great article about it can be found here.

Content

@napsternxg
napsternxg / wikidata_subclass.sparql
Created July 14, 2020 05:08
Wikidata get all subclasses of a given class
SELECT ?subClass ?subClassLabel ?desc WHERE {
?subClass wdt:P279* wd:Q5. # Here we are getting all subClasses of Human and its subclasses
OPTIONAL {
?subClass rdfs:label ?desc.
FILTER((LANG(?desc)) = "en")
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
@rbeesley
rbeesley / ansi-color.cmd
Last active October 9, 2024 03:53
Inspired by Daniel Crisman's BASH script from http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html. This file echoes a bunch of color codes to the terminal to demonstrate how they will render. The `Data Segment` portion of the file defines the table layout and allows the user to configure whatever matrix of ANSI Escape Sequence control characte…
@ECHO OFF & :: ANSI-COLOR :: Authored by Ryan Beesley :: https://github.com/rbeesley
GOTO :DEFINE_MACROS
%=- Entry point after macro definitions -=%
:MAIN
SETLOCAL ENABLEDELAYEDEXPANSION
CALL :PARSE_ARGS %1 %2 %3 %4 %5 %6 %7 %8 %9
:: Error when parsing
IF ERRORLEVEL 1 %@exit% %ERRORLEVEL%
:: Parsing success
@soraxas
soraxas / SurfingKeys.js
Last active February 4, 2025 07:13
SurfingKeys settings (vim keybindings for browser)
// git.io url: https://tinyurl.com/SurfingKeys-settings or https://git.io/JfXjB
// inspired by https://github.com/Foldex/surfingkeys-config/blob/master/config.js
// remove conflict with browser's history, download pannel toggle
// unmap('<Ctrl-j>');
// iunmap('<Ctrl-j>');
// vunmap('<Ctrl-j>');
// unmap('<Ctrl-h>');
// iunmap('<Ctrl-h>');
// vunmap('<Ctrl-h>');
@atamaniuc
atamaniuc / remove-array-multi-dem-duplicates.js
Created May 8, 2020 14:14
Removing Duplicate Arrays from an Array of Arrays
let bigArray = [["a", "b", "c"],
[1, 2, 3],
[true, true, false],
[":)", ":P", ":X"],
[true, false, false],
[1, 2, 3],
["foo", "zorb", "blarg"],
["a", "b", "c"]];
let uniqueArray = Array.from(new Set(bigArray.map(JSON.stringify)), JSON.parse);
@GlauberF
GlauberF / KeyEventSimulator.js
Created April 29, 2020 10:28
A function for simulating key event in JavaScript. You just have to choose what key and keyboard event you want to simulate.
/**
* Simulate a key event.
* @param {Number} keyCode The keyCode of the key to simulate
* @param {String} type (optional) The type of event : down, up or press. The default is down
* @param {Object} modifiers (optional) An object which contains modifiers keys { ctrlKey: true, altKey: false, ...}
*/
function simulateKey (keyCode, type, modifiers) {
var evtName = (typeof(type) === "string") ? "key" + type : "keydown";
var modifier = (typeof(modifiers) === "object") ? modifier : {};