Skip to content

Instantly share code, notes, and snippets.

View djnugent's full-sized avatar

Daniel Nugent djnugent

View GitHub Profile
@djnugent
djnugent / timesync.js
Created September 2, 2023 05:08
Time sync implementation in Javascript
// Function to generate normally distributed random numbers
function normalDistribution(mean, stdDev) {
let u = 0, v = 0;
while (u === 0) u = Math.random();
while (v === 0) v = Math.random();
return mean + stdDev * Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
}
function time_ns() {
const nanos = process.hrtime.bigint();
# Make mouse useful in copy mode
set -g mouse on
#set-option -s set-clipboard off
#bind-key -T copy-mode-vi v send-keys -X begin-selection
#bind-key -T copy-mode-vi y send-keys -X copy-selection
#bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
#set-option -s set-clipboard off
Boot Info Script 8f991e4 + Boot-Repair extra info [Boot-Info 25oct2017]
============================= Boot Info Summary: ===============================
=> No known boot loader is installed in the MBR of /dev/sda.
sda1: __________________________________________________________________________
File system: iso9660
@djnugent
djnugent / please
Created November 1, 2018 02:20
Instead of !!
function please() {
cmd=$(history | cut -c 8- | tail -2 | head -1)
sudo $cmd
}
case $HOSTNAME in
(dbox) prompt_clr=71;;
(docker) prompt_clr=110;;
(*) prompt_clr=183;;
esac
if [ "$color_prompt" = yes ]; then
PS1="\[\033[38;5;${prompt_clr}m\]\[\033[48;5;238m\] \u \[$(tput sgr0)\]\[\033[38;5;255m\]\[\033[48;5;${prompt_clr}m\] \W \[$(tput sgr0)\] "
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
@djnugent
djnugent / install_roskinetic_interactive.py
Last active October 16, 2018 08:00
Install ROS kinetic with one command
#!/usr/bin/env python
# Install any version of ROS Kinetic with one command!
# Daniel Nugent 2018
# Requirements:
# - Ubuntu 16
# - python 2.7
# - pip
# Import subprocess and sys
import subprocess
@djnugent
djnugent / install_tmux.sh
Created September 18, 2017 19:32
Install Tmux locally
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.5
@djnugent
djnugent / install_sublime2.md
Last active September 18, 2017 19:33 — forked from martijnvandijk/install.md
Installing Sublime Text 2 in linux without root access

Grab the tarball

Create your personal apps folder

mkdir ~/apps

Extract sublime text into your apps folder

tar -xvzf Sublime*.tar.bz2 -C ~/apps/

Create ~/bin

import cv2
import imageio
import numpy as np
def nothing():
pass
import math
import time
class pos_control:
def __init__(self, kP, kI, kD, max_int = 100, max_spd=10):
limits = [-math.sqrt(2) * max_spd,math.sqrt(2) * max_spd]
self.x_pid = PID(kP, kI, kD, max_int = max_int, limits = limits)
self.y_pid = PID(kP, kI, kD, max_int = max_int, limits = limits)