Skip to content

Instantly share code, notes, and snippets.

View constructor-s's full-sized avatar

Bill constructor-s

View GitHub Profile
@constructor-s
constructor-s / temp.py
Created August 22, 2017 15:12
Tracker
import endo_transform
import numpy as np
data = np.loadtxt(r'N:\GTx\ToBill\20170822_NUDGE_TEST\Nudge Test - Sheet1.csv', skiprows=2, delimiter=',')
tracker1 = data[:, (1, 2, 3, 5, 6, 7, 8)]
tracker2 = data[:, np.array((1, 2, 3, 5, 6, 7, 8)) + 8]
for i, (t1, t2) in enumerate(zip(tracker1, tracker2)):
@constructor-s
constructor-s / cout_speed_test.cpp
Created January 13, 2018 01:22
cout_speed_test.cpp
#include <iostream>
#include <chrono>
using namespace std;
using namespace std::chrono;
int main()
{
const int N = 100000;
% pts1 = [-97.7589, 107.423, 424;
% 92.029, 110.208, 432;
% 73.7443, 20.5885, 427;
% -75.4565, 17.4702, 424;
% 13.7856, 64.4569, 425];
%
% pts2 = [-37.0552, -124.662, -411.111;
% -28.2589, 87.5111, -421.536;
% -123.679, 63.8717, -417.216;
% -132.088, -101.241, -408.636;
@constructor-s
constructor-s / polyarea.py
Created March 6, 2019 02:34
Calculate area in polygon
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 5 20:17:08 2019
@author: bill
"""
import matplotlib.pyplot as plt
import numpy as np
@constructor-s
constructor-s / PrintPDF.ahk
Created March 26, 2020 19:54
AutoHotKey to print current page to PDF in browser
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^j::
Click
Sleep, 500
Send, ^p
Sleep, 1000
% M up N down
% stays the same unless
% all previous M trials are 0 -> stop up, go down
% all previous N trials are 1 -> stop down, go up
m = 1
n = 1
d = 5
num = 1e7
phi = @(x) atan(1*x)/pi + 0.5
@constructor-s
constructor-s / static_qt_windows.md
Created July 3, 2020 03:14
How to use static Qt (5.12.8) on Windows 10 (qt5:x64-windows-static)

Compile static Qt

Use vcpkg with the following command:

vcpkg install qt5:x64-windows-static

Configure compiler

@constructor-s
constructor-s / pi_video_cam.py
Created July 18, 2020 04:14
Raspberry Pi continous camera recording with built-in picamera and frame timestamp in Python (very low CPU usage)
import picamera
from picamera import PiCamera
import time
import signal
import sys
import threading
from datetime import datetime
CAMERA_WAIT_SEC = 1
CAMERA_ROTATE_SEC = 1800
@constructor-s
constructor-s / hitron_router.py
Created August 7, 2020 11:10
Hitron router API, API version 1.11, Software Version 7.1.1.32, Python script for getting sysinfo, reboot
import logging
import requests
import json
from urllib.parse import urlunparse
from getpass import getpass
from argparse import ArgumentParser
parser = ArgumentParser("Hitron router API, API version 1.11, Software Version 7.1.1.32")
parser.add_argument("-u", "--username", type=str, default="cusadmin")
parser.add_argument("-p", "--password", type=str)
@constructor-s
constructor-s / bayesian_regression.ipynb
Created August 27, 2020 00:18
Bayesian Linear Regression
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.