Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Mike DePalatis mivade

👋
View GitHub Profile
View gnotes.md

Locations for Gnome settings:

~/.gconf
~/.local/share/gnome-shell
~/.config/dconf

Probably don't want to copy over ~/.local/share/gnome-shell/application_state.

@mivade
mivade / paultrap.py
Last active Aug 29, 2015
Moving over the paultrap repository to be a gist since it was only one file anyway.
View paultrap.py
"""paultrap.py - Provides a simple object for calculating stability
boundaries for a linear Paul trap.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
View usbtmc_pipe.py
"""USBTMC pipe script
This script is used to pipe commands and queries to and from a USBTMC
device and is intended to be run using the following socat command::
socat tcp-listen:5025,fork,reuseaddr,crnl,tcpwrap=script\
EXEC:"python usbtmc_pipe.py",su-d=pi,pty,echo=0
"""
@mivade
mivade / .gitignore
Last active Aug 29, 2015
nmapy - Simple web frontend to nmap
View .gitignore
*~
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
@mivade
mivade / recovery_notes.md
Last active Aug 29, 2015
Recovery Notes
View recovery_notes.md

Recovering from a disk failure

This gist contains notes on what to do when needing to recover from a disk failure. A good tool to use is the SystemRescueCd live image which includes all the useful tools for performing recovery operations.

Booting to a USB disk from grub

If for whatever reason you can't boot from a USB disk with the BIOS, then you can still use grub. Simply do

set root=(hd1)
View sphinx.rst

Sphinx notes

Standard extensions

Usually, the numpydoc format is the easiest to use and read for docstrings. In order to make things Just Work, use the following in conf.py:

@mivade
mivade / admonitions.js
Created Dec 7, 2014
Colored admonitions in Pelican with pelican-bootstrap3
View admonitions.js
/*
Simple jQuery calls to replace RST admonitions with Bootstrap
alerts.
This is intended to work with the pelican-bootstrap3 Pelican theme,
but may also work with others.
This script is public domain.
*/
@mivade
mivade / pyqtornado.py
Last active Apr 11, 2016
PyQt with Tornado
View pyqtornado.py
"""Demonstration of combining the Qt and Tornado event loops."""
from PyQt4 import QtGui, QtCore
from tornado.ioloop import IOLoop
from tornado import gen
from tornado.httpclient import AsyncHTTPClient
URL = "https://www.random.org/integers/?num=1&min=100&max=999&col=1&base=10&format=plain&rnd=new"
class MainWindow(QtGui.QMainWindow):
@mivade
mivade / tornadobg.py
Last active Mar 17, 2020
Background tasks with tornado and concurrent.futures
View tornadobg.py
"""A simple demonstration of running background tasks with Tornado.
Here I am using a basic TCP server which handles streams and keeps
them open while asynchronously performing a fake task in the
background. In order to test it, simply telnet to localhost port 8080
and start typing things to see that the server receives the messages.
The advantage to running on an executor instead of conventional
threads is that we can more easily shut it down by stopping the
tornado IO loop.
@mivade
mivade / tornadosse.py
Last active Feb 9, 2021
Tornado server-sent events
View tornadosse.py
"""Demonstration of server-sent events with Tornado. To see the
stream, you can either point your browser to ``http://localhost:8080``
or use ``curl`` like so::
$ curl http://localhost:8080/events
"""
import signal
from tornado import web, gen