Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.
| // 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks. | |
| // You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/) | |
| (() => { | |
| const SHOW_SIDES = false; // color sides of DOM nodes? | |
| const COLOR_SURFACE = true; // color tops of DOM nodes? | |
| const COLOR_RANDOM = false; // randomise color? | |
| const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com) | |
| const MAX_ROTATION = 180; // set to 360 to rotate all the way round | |
| const THICKNESS = 20; // thickness of layers | |
| const DISTANCE = 10000; // ¯\\_(ツ)_/¯ |
| # Reference : https://stackoverflow.com/a/59539843 | |
| from PyQt5.QtCore import * | |
| from PyQt5.QtGui import * | |
| from PyQt5.QtWidgets import * | |
| from PyQt5.QtCore import QObject, pyqtSignal | |
| import sys | |
| import time | |
| import threading |
| #!/usr/bin/python3 | |
| # -*- coding: utf-8 -*- | |
| from PyQt5.QtCore import Qt | |
| from PyQt5.QtGui import QImage, QPixmap, QPalette, QPainter | |
| from PyQt5.QtPrintSupport import QPrintDialog, QPrinter | |
| from PyQt5.QtWidgets import QLabel, QSizePolicy, QScrollArea, QMessageBox, QMainWindow, QMenu, QAction, \ | |
| qApp, QFileDialog |
| #!/usr/bin/python3 | |
| #-*- coding:utf8 -*- | |
| import cairo | |
| import gi | |
| gi.require_version('Pango', '1.0') | |
| gi.require_version('PangoCairo', '1.0') | |
| from gi.repository import Pango, PangoCairo | |
| surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 600, 100) |
| #!/bin/bash | |
| # Starts your AWS instance, connects via SSH and launches Chrome with the remote Jupyter Notebook page open. | |
| # Usage is as follows: | |
| # 1. Run this script, so that Chrome has launched and SSH connection is established. | |
| # 2. Execute 'jupyter notebook' on the AWS instance. | |
| # 3. Reload the page in Chrome and log in to Jupyter Notebook. | |
| # | |
| # Note: we use Chrome, as there's a known issue with Safari that won't let Jupyter Notebook connect to a remote kernel. | |
| # |
| import asyncio | |
| import threading | |
| import random | |
| def thr(i): | |
| # we need to create a new loop for the thread, and set it as the 'default' | |
| # loop that will be returned by calls to asyncio.get_event_loop() from this | |
| # thread. | |
| loop = asyncio.new_event_loop() |
| # Note – this is not a bash script (some of the steps require reboot) | |
| # I named it .sh just so Github does correct syntax highlighting. | |
| # | |
| # This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5 | |
| # | |
| # The CUDA part is mostly based on this excellent blog post: | |
| # http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/ | |
| # Install various packages | |
| sudo apt-get update |
| # | |
| # read/write access to python's memory, using a custom bytearray. | |
| # some code taken from: http://tinyurl.com/q7duzxj | |
| # | |
| # tested on: | |
| # Python 2.7.10, ubuntu 32bit | |
| # Python 2.7.8, win32 | |
| # | |
| # example of correct output: | |
| # inspecting int=0x41424344, at 0x0228f898 |
| def color(text, **user_styles): | |
| styles = { | |
| # styles | |
| 'reset': '\033[0m', | |
| 'bold': '\033[01m', | |
| 'disabled': '\033[02m', | |
| 'underline': '\033[04m', | |
| 'reverse': '\033[07m', |