Nothing Special   »   [go: up one dir, main page]

Skip to content

Instantly share code, notes, and snippets.

@paretech
paretech / exampleApplyCalOffsets.m
Last active September 15, 2022 22:33
This MATLAB+Psychtoolbox example script contains naively approach of applying spatial calibration offsets using Psychtoolbox imaging pipeline. It is posted along with support post on the PTB website. Note that this is not production code, it is simply an example to demonstrate a specific concept.
% Demonstrate attempt at applying x, y offsets via PTB processing hooks.
%
% Instructions
% ------------
% After running, press any key to advance offset position. Position will
% not change until key-up event. The script will run indefinitely until the
% escape key is pressed.
%
% Known Issues
% ------------
@paretech
paretech / shuffle_blocks.py
Created March 20, 2022 19:46
Shuffle multiple blocks of tabular data by unique value.
# %% [markdown]
# # Data Generation and Sequencing
# %%
import pandas as pd
import numpy as np
import random
# %%
primary = pd.DataFrame({'primary': ['A', 'B', 'C']})
import pandas as pd
def accounting_month(start, end):
month_end = pd.date_range(start=start, end=end, freq=pd.tseries.offsets.LastWeekOfMonth(n=1, weekday=6))
month_start = month_end.shift(periods=-1, freq=pd.tseries.offsets.LastWeekOfMonth(n=1, weekday=6)).shift(periods=1, freq='D')
weeks_in_month = (month_end - month_start).shift(periods=1, freq='D') / pd.Timedelta(7, 'D')
return pd.DataFrame({'start': month_start, 'end': month_end}, index=month_end.to_period('M'))
if __name__ == '__main__':
accounting_calendar = accounting_month('2019-01-01', '2022-01-01')
@paretech
paretech / aio1.py
Created July 26, 2019 14:37
Python AsyncIO Example #1
import asyncio
import logging
import random
import sys
LOGGER = logging.getLogger(__name__)
LOGGER.addHandler(logging.NullHandler())
def config_logging():
@paretech
paretech / gist:6bcd39658b42098cbe2c3d19b7245e48
Created August 11, 2018 22:49
clang2py -c -d -l ftd2xx64.dll ftd2xx.h -vvv -o _ftd2xx64.py
# generated by 'clang2py'
# flags '-c -d -l ftd2xx64.dll ftd2xx.h -vvv -o _ftd2xx64.py'
# -*- coding: utf-8 -*-
#
# TARGET arch is: []
# WORD_SIZE is: 4
# POINTER_SIZE is: 8
# LONGDOUBLE_SIZE is: 8
#
import ctypes
@paretech
paretech / RemoveWindows10Apps
Created August 10, 2018 11:52
Remove those Windows 10 Apps...
# Modified based off https://www.oueta.com/microsoft/how-to-uninstall-built-in-apps-from-windows-10/
Get-AppxPackage *twitter* | Remove-AppxPackage
Get-AppxPackage *oneconnect* | Remove-AppxPackage
Get-AppxPackage *people* | Remove-AppxPackage
Get-AppxPackage *messaging* | Remove-AppxPackage
Get-AppxPackage *communicationsapps* | Remove-AppxPackage
Get-AppxPackage *print3d* | Remove-AppxPackage
Get-AppxPackage *autodesksketch* | Remove-AppxPackage
Get-AppxPackage *3dview* | Remove-AppxPackage
Get-AppxPackage *3dbuilder* | Remove-AppxPackage
# generated by 'clang2py'
# flags '-c -d -k defst -l build/libftd2xx.so.1.4.8 -i ftd2xx.h -o test3.py'
# -*- coding: utf-8 -*-
#
# TARGET arch is: []
# WORD_SIZE is: 8
# POINTER_SIZE is: 8
# LONGDOUBLE_SIZE is: 16
#
import ctypes
@paretech
paretech / multicast_server.py
Created April 21, 2017 13:38
A simple multicast server that repeatedly says "Test"
"""multicast_server.py - A simple multicast server that says "Test"."""
import socket
import struct
import time
class multicast_speaker():
def __init__(self, address, port, ttl=2, timeout=0.2):
self.group = address, int(port)
@paretech
paretech / haystack.py
Created April 21, 2017 13:34
Sifting files generated by photorec using md5deep and tiny pieces of python.
#!/usr/bin/env python3
import csv
import os.path
import os
import shutil
'''Haystack.py - sifting through photorec recovered data
Concept of using photorec, md5deep, NSRL "known" file dataset and personal
:: Merge indexed text files and print the result
@ECHO OFF
SETLOCAL EnableDelayedExpansion
:: User Config
SET ina_base=part1_
SET inb_base=part2_
SET out_base=sum12_