Skip to content

Instantly share code, notes, and snippets.

@calumroy
calumroy / create_python_package_locally.md
Last active February 24, 2020 10:03
Create python package locally

Create a python package locally so you can pip install it.

Create your python script mycoolscript.py

Create a new directory with this layout

some_root_dir/
|-- README
|-- setup.py
|-- mycoolscript

Plot ros1 topics with pandas and plotly

import math
import pandas as pd
from pandas import *
import matplotlib.pyplot as plt
from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
#from plotly.offline import *
@calumroy
calumroy / vscode.md
Last active October 7, 2019 14:19
Useful snippets about vscode

Tasks task.json

Example task.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "_runner": "terminal",
    "tasks": [
        {
@calumroy
calumroy / nauti_note.md
Last active June 3, 2019 09:27
A collection of useful commands for data processing nauticraft logs

Useful bits of python for Nauticraft Notebooks

from IPython.display import HTML
HTML('''<script>
code_show=true; 
function code_toggle() {
 if (code_show){
 $('div.input').hide();
 } else {
@calumroy
calumroy / pyqt5.7_virtualenvs.md
Last active April 8, 2018 13:04
PyQt5.7 installation with virtualenvs

You can try (as explained in the comments) to compile PyQt5.7 yourself, using a different version of Python (3.4.3 and 3.4.4 worked for me, everything above 3.5 did not). Note that I also compiled Qt5.7 myself, but you can use the one provided by the installer. Here is a short, hopefully exhaustive, set of commands to setup a virtual environment:

Install dependencies using apt-get:

sudo apt-get install -y build-essential libgl1-mesa-dev libx11-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libfontconfig1-dev libfreetype6-dev libglu1-mesa-dev libssl-dev libcups2-dev python3-pip git

Install Python 3.4.4:

@calumroy
calumroy / win10_AutoStart.md
Last active September 26, 2024 19:33
Windows 10 automatically login and start a program.

Auto start a user program and hide windows 10 home from a user.

The goal is to setup a windows 10 home computer that automatically starts up and runs a user .exe program. No windows logos should be shown and the user should not be able to interact with other windows applications.

Upon shutdown of the .exe the computer should shutdown.

Regedit

Windows 10 home or pro doesn't allow you to directly set a classic windows app such as a user .exe program as the startup. We instead call a batch script that calls our .exe. instead.

A windows batch script is used to make a .exe run on startup.

@calumroy
calumroy / conda.md
Last active November 19, 2017 14:32
conda

Conda and Anaconda?

conda is the package manager.
Anaconda is a set of about a hundred packages including conda, numpy, scipy, ipython notebook, and so on.

You installed Miniconda, which is a smaller alternative to Anaconda that is just conda and its dependencies
(as opposed to Anaconda, which is conda and a bunch of other packages like numpy, scipy, ipython notebook, etc.).
Once you have Miniconda, you can easily install Anaconda into it with conda install anaconda.

Install linux

@calumroy
calumroy / docker_info.md
Last active January 5, 2022 01:58
Docker containers

Docker Containers

Install docker from https://docs.docker.com/engine/installation/

Run the docker for Mac app. This must be started before you can call docker commands.

Docker containers are like a lightweight virtual machine.
They can be created from scratch or downloaded from the docker hub https://hub.docker.com/

An instance of an image is called a container. You have an image, which is a set of layers. If you start this image, you have a running container of this image. You can have many running containers of the same image. You can stop a container and you can run a stopped container and keep on doing things you where doing with it.

@calumroy
calumroy / gist:d1fcf2455c3878aa32bd1eea167e1f0f
Last active April 8, 2018 09:23
Access PyQt4 In virtual env

Install PyQt4 access it from a virtual env

Just install it system wide, see PyQt4 installation procedure

SIP Installation. Download the .tar file then uncompress

tar -xzf

then configure it with

CANopen

Detailed information about CANopen can be found here; http://www.canopensolutions.com/english/about_canopen/about_canopen.shtml

A standardised CAN network protocol used in the auto and manufacturing industry. CANopen uses a normal CAN bus but it is a network protocol defining how the CAN packets should look. It allows speed of upto 1Mbit per second and has many easy to use (though often expensive) software configuration suites and CAN bus monitoring programs. The advantage of using CANopen standard over just a simple CAN bus (where the user defines each can packet)