This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Golang >= 1.18 (uses generics). | |
// Golang < 1.18 without generics (replace T with explicit type in PoolFilter function signature). | |
package main | |
import ( | |
"sort" | |
"github.com/alitto/pond" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on answer from https://stackoverflow.com/questions/57046930/node-js-spawn-keep-stdout-and-stderr-in-the-original-order | |
const { spawn } = require('child_process'); | |
const options = { | |
shell: true, // Keep shell: true to redirect StdErr to StdOut. | |
stdio: [ | |
'inherit', // StdIn. Fixes "ERROR: Input redirection is not supported, exiting the process immediately" on Windows. | |
'pipe', // StdOut. | |
'pipe', // StdErr. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To stop json.Marshal from using HTMLEscape and adding trailing newline, see: | |
// https://github.com/SCP002/jsonexraw | |
package main | |
import ( | |
"fmt" | |
json "github.com/yaegashi/jsonex.go/v1" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
# Requirements: | |
# Python 3.7+ | |
# pip install dataclasses-json | |
import dataclasses as dc | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install --save-dev class-transformer | |
import 'reflect-metadata'; | |
import { classToPlain, deserialize, Exclude, Type } from 'class-transformer'; | |
const inpJsonStr: string = ` | |
{ | |
"topKnownKey": 1, | |
"topUnknownKey": 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.util.Scanner; | |
public class ProcessExample { | |
public static void main(String[] args) { | |
ProcessBuilder pb = new ProcessBuilder(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Java 13+ (Uses multi-line string). | |
* Java 8+ without multi-line string (line 87). | |
* Require Jackson dependency (Maven example; Add to <dependencies> in your pom.xml): | |
* <dependency> | |
* <groupId>com.fasterxml.jackson.core</groupId> | |
* <artifactId>jackson-databind</artifactId> | |
* <version>2.12.2</version> | |
* </dependency> | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.concurrent.*; | |
abstract class ConcurrentFilter { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
# Requirements: | |
# Python 3.7+ (uses data classes, lines 16 and 25). | |
import dataclasses as dc | |
import os | |
import subprocess | |
import sys |
OlderNewer