Skip to content

Instantly share code, notes, and snippets.

View rwv37's full-sized avatar
💭
37

Robert William Vesterman rwv37

💭
37
View GitHub Profile
@tor-gu
tor-gu / model_with_points_removed.py
Created November 7, 2023 04:57
Find optimal points to remove so that a model fits better.
import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import LinearConstraint, minimize
np.random.seed(3737)
LO, HI = 0, 100
n = 100 # Number of points
k = 73 # Points to remove
@georg-jung
georg-jung / ProcessAsyncHelper.cs
Last active December 30, 2023 02:14 — forked from AlexMAS/ProcessAsyncHelper.cs
Use https://github.com/Tyrrrz/CliWrap instead, the following code has some shortcomings
using System;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
// based on https://gist.github.com/AlexMAS/276eed492bc989e13dcce7c78b9e179d
public static class ProcessAsyncHelper
{
public static async Task<ProcessResult> RunProcessAsync(string command, string arguments, int timeout)
{
@AlexMAS
AlexMAS / ProcessAsyncHelper.cs
Last active April 22, 2024 02:50
The right way to run external process in .NET (async version)
using System;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
public static class ProcessAsyncHelper
{
public static async Task<ProcessResult> ExecuteShellCommand(string command, string arguments, int timeout)
{
var result = new ProcessResult();
@mattrude
mattrude / mediawiki-run-jobs.sh
Created January 3, 2014 06:03
A bash script to continuously run the runJobs.php script in small batches to allow a slow server to keep up and still allow public traffic on the site. This script should be placed in the mediawiki maintenance directory.
# Run meny MediaWiki Jobs
while [ `php showJobs.php` != 0 ];
do
echo -n "Starting over; `php showJobs.php` jobs left to run; running 10 jobs in 2 cycles."
php runJobs.php --maxjobs 10 --procs 5 --quiet
LOAD="`uptime |awk '{ print $10 }' |sed 's/,//g'`"
if [ $LOAD > 1.9 ]; then
WAIT=`echo "sqrt(2 * $LOAD * 50)" |bc`
echo " - Sleeping for $WAIT secs"
sleep $WAIT