Skip to content

Instantly share code, notes, and snippets.

@chaosmail
chaosmail / python-pid_controller
Last active September 26, 2022 13:13
Simple PID Controller
def pid_controller(y, yc, h=1, Ti=1, Td=1, Kp=1, u0=0, e0=0)
"""Calculate System Input using a PID Controller
Arguments:
y .. Measured Output of the System
yc .. Desired Output of the System
h .. Sampling Time
Kp .. Controller Gain Constant
Ti .. Controller Integration Constant
Td .. Controller Derivation Constant
@wilbowma
wilbowma / jail.pl
Last active August 1, 2022 11:16
A perl script to create nginx chroot in arch linux.
#a/usr/bin/perl
# This script was hastily cobbled together for my own use. It can
# probably break your system. Use at your own risk.
$JAIL = "/srv/http";
$USER = "http";
$GROUP = "http";
$WWW_DIR = "www";
sub run{
@netj
netj / memusg
Last active June 4, 2024 07:04
memusg -- Measure memory usage of processes
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #