Skip to content

Instantly share code, notes, and snippets.

View mFoxRU's full-sized avatar
🀄
🀄

Mikhail mFoxRU

🀄
🀄
  • Russia, Saint-Petersburg
View GitHub Profile
@mFoxRU
mFoxRU / python-3.6-pi.sh
Last active July 15, 2021 17:10 — forked from slendidev/python-3.6-pi.sh
Install python 3.6 on your RPi!
sudo apt-get update
sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev -y
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
tar xf Python-3.6.4.tar.xz
cd Python-3.6.4
./configure
make -j4
sudo make altinstall
echo "Do you wish to delete the source code and uninstall all previously installed packages? {Y/N} (Case sensitive!)"
@mFoxRU
mFoxRU / dynamic_gui.py
Created March 27, 2017 15:56
Dynamic gui creation prototype
# encoding: utf-8
__author__ = 'mFoxRU'
import sys
from functools import partial
from PyQt5 import QtWidgets
class Widget1(QtWidgets.QWidget):
@mFoxRU
mFoxRU / rpc.py
Last active February 12, 2016 15:59
Tiny json-rpc implementation for my twisted project
# encoding: utf-8
__author__ = 'mFoxRU'
import json
from twisted.internet.defer import maybeDeferred
class Rpc(object):
_fields = {'jsonrpc', 'method'}
from __future__ import division
import numpy as np
def periodogram_fft(x, fs=1.0, window=None, nfft=256):
"""
Calculate a PSD estimate using FFT
:param x: 1-d iterable of values
:param fs: Sampling frequency
:param window: Window
@mFoxRU
mFoxRU / rolling_window.py
Last active August 29, 2015 14:17
Modified version of rolling window function from (1) that allows choosing rolling (increment) step. // (1) http://www.rigtorp.se/2011/01/01/rolling-statistics-numpy.html
import numpy as np
def rolling_window(a, window, step=1):
n = (a.shape[-1] - window) // step + 1
shape = a.shape[:-1] + (n, window)
strides = a.strides[:-1] + (a.strides[-1]*step, a.strides[-1])
return np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)
# This is a raw listing of the imports that take place dynamically by calling
# the pyqtgraph/__init__.py:importAll() in the following scenarios:
#importAll('graphicsItems', globals(), locals())
#importAll('widgets', globals(), locals(), excludes=['MatplotlibWidget', 'RemoteGraphicsView'])
from .graphicsItems.ArrowItem import ArrowItem
from .graphicsItems.GraphicsWidgetAnchor import GraphicsWidgetAnchor
from .graphicsItems.GraphicsWidgetAnchor import Point
from .graphicsItems.GraphicsWidgetAnchor import QtCore
@mFoxRU
mFoxRU / logger.py
Last active October 1, 2015 23:04
Singleton logger
__author__ = 'mFoxRU'
from datetime import datetime as dt
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
@mFoxRU
mFoxRU / tanuki.py
Created May 19, 2014 17:34
TO MAH BRO
__author__ = 'mFoxRU'
import sys
code = {0x0: ' ', 0x1: '_', 0x2: '-', 0x3: '.', 0x4: ':', 0x5: '\'',
0x6: '(', 0x7: ')', 0x8: '=', 0x9: ',', 0xa: 'o', 0xb: '|',
0xc: '/', 0xd: '\\', 0xe: ';', 0xf: '\n'}
src = '00000000000000000000000000000030000000000000000404f00000000000013322223311000113345325552325500003004f000000000035000000900005550000500004000350000c005f000000000590000000000000000006028a746a8270003004f00000000400000900000000000000055300e003500114004f00000000400000000004000000900000053a35532537700400113322f00000000400000000000400000000000000003132511b054553f0000000003000000000004000900033004325011350c000e000030f000000003500000009000400001350053053550000c000c005f00000034303530000000042245133225553770030050250000113225f00003554450005230032553005300030000000000000113225f0000433340000011d005300533770000050000113225f00004455432255000537770000000000113225f13322434450003000000000300113225f00000045034300000000113225f00500003445040113225f00000011503445f332255000544450000000'
end = 'rHsAjuPc\[P