Skip to content

Instantly share code, notes, and snippets.

@Trevol
Trevol / toQImage.py
Created May 4, 2020 19:00 — forked from smex/toQImage.py
Convert numpy arrays (from opencv) to QImage
from PyQt4.QtGui import QImage, qRgb
import numpy as np
class NotImplementedException:
pass
gray_color_table = [qRgb(i, i, i) for i in range(256)]
def toQImage(im, copy=False):
if im is None:
# https://www.linuxbabe.com/ubuntu/install-nvidia-driver-ubuntu-18-04
sudo ubuntu-drivers devices
sudo apt install nvidia-driver-version-number
sudo lshw -c display
@Trevol
Trevol / msi-gtx1060-ubuntu-18.04-deeplearning.md
Created July 5, 2019 13:37 — forked from hereismari/msi-gtx1060-ubuntu-18.04-deeplearning.md
Setting up a MSI laptop with GPU (gtx1060), Installing Ubuntu 18.04, CUDA, CDNN, Pytorch and TensorFlow
@Trevol
Trevol / tune_plt_ticks.py
Created May 15, 2019 12:19
Matplotlib.pyplot: on/off ticks, labels and tune other tick params
from matplotlib import pyplot as plt
plt.plot(range(10))
plt.tick_params(
axis='x', # changes apply to the x-axis
which='both', # both major and minor ticks are affected
bottom=False, # ticks along the bottom edge are off
top=False, # ticks along the top edge are off
labelbottom=False) # labels along the bottom edge are off
plt.show()
plt.savefig('plot')
@Trevol
Trevol / Install NVIDIA Driver and CUDA.md
Last active April 5, 2019 14:06 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
@Trevol
Trevol / inxi.sh
Created April 5, 2019 08:51
Info about system and hardware
inxi -F
@Trevol
Trevol / switch_main_monitor.sh
Created April 4, 2019 14:20
How to list monitors and switch main monitor in Linux
xrandr
xrandr --output <display> --primary
@Trevol
Trevol / timer_example.enaml
Created October 15, 2018 08:27 — forked from jason-s/timer_example.enaml
timer example using a view controller
from enaml.widgets.api import Window, Container, PushButton, Timer
class StateMachine(object):
# normally handles some complicated view controller process
# but here we just want to listen for the timer timeout
def __init__(self, view):
self.view = view
self.timer = Timer()
self.timer.interval = 350
self.timer.single_shot = True