Skip to content

Instantly share code, notes, and snippets.

@ryunp
ryunp / apps.csv
Last active December 4, 2022 05:13
Basic SteamCMD app management using a clever CSV file
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 2.
APP_ID,APP_NAME,APP_START_CMD
565060,Avorion,AvorionServer/server.sh --galaxy-name "Expert 2-3-0" --admin ryunp
@ryunp
ryunp / wfdrvr.ahk
Last active October 25, 2022 00:21
[WreckFest] Automated driving for high returns custom game spam
; Author: Ryan Paul
; Date: 9/3/22
; Target_Game: Wreckfest
; Description: Automated driving for high returns custom game spam
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cute Typer Test</title>
<script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.12"></script>
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace ConcurrencyTest
{
class Program
@ryunp
ryunp / async generator - iterator.js
Created February 29, 2020 12:09
Testing async generator and iterators
/**
* Date: 2/29/20
* Author: Ryan Paul
* Description:
* Oversimplified API mockup with paginated query behavior,
* testing async generator functions with async iterators.
*/
// Stateless helpers
var randBetween = (min, max) => min + Math.floor(Math.random() * (max - min))
/* Change files on filesystem and/or config to see error handling */
// Simulate configurations
config = { installPath: 'root/place/subplace' }
d2config = {
files: [
'a.dll',
'abc.txt',
'deeper/d.txt'
]
@ryunp
ryunp / debounce.js
Last active February 19, 2020 01:18
/** Ryan Paul 12/25/19
A debouncer wraps a function with a delayed execution timer.
Calling the debounced function before the delay elapsed will reset the
execution timer.
*/
function debounce (callback, delay) {
var timer = null
function delayExecution (...args) {
if (timer) {
// Mock File System
var files = new Map([
["settings.json", '{"updateInterval": 1800000,"channelName":"myChannel"}']
])
// Mock File IO interface
var fsPromises = {
readFile: function readFile (path) {
const resolver = (resolve) => {
setTimeout(() => resolve(files.get(path)), 2000)
/* There are basically 3 solutions for async programming, and 2 of which are with related to Promises. */
/* Promises Notation (#1 & #2) */
// The Promise definition
function timedAction() {
return new Promise(resolve => {
setTimeout(() => { resolve('done') }, 2000)
})
}
/*
Author: Ryan Paul
Date: 12/03/18
Description: Extracted code showing iterations over basic file existence functionality
Environment: Node.js
*/
// Iteation 1: Initial attempt:
function isInstalled(installPath) {
const fileNames = ['Game.exe', 'Diablo II.exe', 'd2data.mpq']