This file contains hidden or 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
ip addr show eth0 | grep inet | |
netsh interface portproxy add v4tov4 listenport=2200 listenaddress=0.0.0.0 connectport=2200 connectaddress=172.22.43.247 |
This file contains hidden or 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
const net = require('net') | |
const server = net.createServer({ allowHalfOpen: true }, (socket) => { | |
socket.on('data', (data) => { | |
console.log('Server <-', data.toString()) | |
if (!socket.writableFinished) { | |
socket.write('hello') | |
console.log('Server -> hello') | |
// half-close | |
socket.end() |
This file contains hidden or 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
Array(300_000_000).fill(1) |
This file contains hidden or 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
#!/bin/bash | |
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | |
PARENT_DIR=$( dirname $SCRIPT_DIR ) |
This file contains hidden or 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
const nReadlines = require("n-readlines"); | |
const fs = require("fs"); | |
const events = require('events'); | |
main().then(() => { | |
const used = process.memoryUsage().heapUsed / 1024 / 1024; | |
console.log( | |
`The script uses approximately ${Math.round(used * 100) / 100} MB` | |
); |
This file contains hidden or 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
C:\Windows\system32\wsl.exe ssh %* |
This file contains hidden or 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
export class BaseWorkerService<TaskInput, TaskOutput> { | |
private queue: QueueObject<TaskInput>; | |
private logger: Logger; | |
private workCounter = 0; | |
constructor( | |
workerName: string, | |
concurrency: number, | |
batchSize: number, | |
batchProcessor: (input: TaskInput[]) => Promise<TaskOutput[]>, |
This file contains hidden or 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
const timeout_function = async (func, timeLimit) => { | |
return new Promise((resolve, reject) => { | |
const timer = setTimeout(() => { | |
console.log("Timeout reached"); | |
reject(null); | |
}, timeLimit); | |
const result = func(); | |
resolve(result); |
This file contains hidden or 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
import os | |
from TheFetchers.TheCommons import filename_check | |
with open(input('> '), 'r') as f: | |
files = [i.strip() for i in f.readlines()] | |
for file in files: | |
fn = os.path.splitext(file)[0]+'.mp4' | |
output_file = filename_check(fn, True) | |
cmd = "ffmpeg -i \"%s\" -vf scale=-2:480 -c:v libx264 \"%s\"" % (file, output_file) | |
os.system(cmd) |
This file contains hidden or 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
import origami | |
APP_TOKEN = "nongh::2113789:5001:8000:54.158.186.33" | |
app = origami.register(APP_TOKEN) | |
@origami.crossdomain | |
@app.listen() | |
def concat(): | |
allText = origami.getTextArray() |
NewerOlder