Skip to content

Instantly share code, notes, and snippets.

@richard-scott
richard-scott / macOS-in-virtualbox.md
Created June 29, 2018 09:19 — forked from rob-smallshire/macOS-in-virtualbox.md
Notes on getting macOS Sierra running in Virtualbox on a Windows 10 host

On Mac

Download, but don't run, the Sierra installer from the Mac App Store. This places the installer at /Applications/Install\ macOS\ Sierra.app/.

Now run the following commands to build a suitable VM image from the installer:

git clone https://github.com/jonanh/osx-vm-templates
cd osx-vm-templates/packer

sudo ../prepare_iso/prepare_vdi.sh -D DISABLE_REMOTE_MANAGEMENT -o macOS_10.12.vdi /Applications/Install\ macOS\ Sierra.app/ .

@richard-scott
richard-scott / create-iso.sh
Created July 4, 2018 09:11 — forked from julianxhokaxhiu/create-iso.sh
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
@richard-scott
richard-scott / highsierra_bootable.sh
Last active July 4, 2018 09:20 — forked from agentsim/highsierra_bootable.sh
Create bootable ISO from HighSierra Installer
# Generate a BaseSystem.dmg with 10.13 Install Packages
hdiutil attach /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/highsierra
hdiutil create -o /tmp/HighSierraBase.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierraBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/highsierra/
mv /tmp/HighSierraBase.cdr.dmg /tmp/BaseSystem.dmg
@richard-scott
richard-scott / XPS-15 9560 Getting Nvidia To Work on KDE Neon
Created September 26, 2018 11:14 — forked from whizzzkid/XPS-15 9560 Getting Nvidia To Work on KDE Neon
[XPS 15 Early 2017 9560 kabylake] Making Nvidia Drivers + (CUDA 8 / CUDA 9 / CUDA 9.1) + Bumblebee work together on linux ( Ubuntu / KDE Neon / Linux Mint / debian )
# Instructions for 4.14 and cuda 9.1
# If upgrading from 4.13 and cuda 9.0
$ sudo apt-get purge --auto-remove libcud*
$ sudo apt-get purge --auto-remove cuda*
$ sudo apt-get purge --auto-remove nvidia*
# also remove the container directory direcotory at /usr/local/cuda-9.0/
# Important libs required with 4.14.x with Cuda 9.X
$ sudo apt install libelf1 libelf-dev
@richard-scott
richard-scott / Download GitHub Repos for KiCad
Last active November 22, 2018 13:42
Download GitHub Repos for KiCad
Installation
------------
1. Create a KiCad folder somewhere on your system, and then create a shortcut to that folder in your $HOME folder.
2. Download "update-kicad-repos.ps1" and move to your KiCad folder e.g. C:\Program Files\KiCad
3. Download "update-kicad-repos.xml" and import as a new task in Task Scheduler.
4. Select for the task to run whether user is logged on or not.
5. Setup a trigger (otherwise it won't automatically run).
6. Click OK and enter the password for the current user.
7. Find "Update KiCad Repos" in the list, right click and click Run.
@richard-scott
richard-scott / gist:f2b9ddb0e888878aca4e01eab46a7e98
Created December 5, 2018 09:25 — forked from corsonr/gist:ba033db9978a536b2b05
Store and display WooCommerce order total weight
<?php
// Store cart weight in the database
add_action('woocommerce_checkout_update_order_meta', 'woo_add_cart_weight');
function woo_add_cart_weight( $order_id ) {
global $woocommerce;
$weight = $woocommerce->cart->cart_contents_weight;
update_post_meta( $order_id, '_cart_weight', $weight );
}
@richard-scott
richard-scott / socksimap.py
Created March 15, 2019 14:39 — forked from sstevan/socksimap.py
Python (v2 - v3) - IMAP through SOCKS proxy using PySocks module
import ssl
from socks import create_connection
from socks import PROXY_TYPE_SOCKS4
from socks import PROXY_TYPE_SOCKS5
from socks import PROXY_TYPE_HTTP
from imaplib import IMAP4
from imaplib import IMAP4_PORT
from imaplib import IMAP4_SSL_PORT
@richard-scott
richard-scott / gist:5681f13ec5137ef16d231d12529cebec
Created March 15, 2019 16:40
HTTP proxy support for Python's xmlrpclib
"""
Provide HTTP proxy support for Python's xmlrpclib, via urllib2.
For example:
>>> transport = HTTPProxyTransport({
... 'http': 'http://myproxyserver',
... })
>>> server = xmlrpclib.Server('http://blogsearch.google.com/ping/RPC2',
... transport=transport)
@richard-scott
richard-scott / kivyconsole.py
Created May 2, 2019 10:37 — forked from aron-bordin/kivyconsole.py
Initial Python/Kivy Terminal Emulator (It's just a performance test. You can use this sample to write your own terminal emulator)
from kivy.base import runTouchApp
from kivy.event import EventDispatcher
from kivy.lang import Builder
from kivy.properties import ObjectProperty, ListProperty, StringProperty, \
NumericProperty, Clock, partial
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.textinput import TextInput
import os
import subprocess
import threading
@richard-scott
richard-scott / README.rst
Created June 4, 2019 09:32 — forked from marianoguerra/README.rst
MQTT Generator Script

MQTT Generator

A simple python 3 script to generate sensor data from a config file and send it to an MQTT broker.

Usage

Download mqttgen.py and config.json files (click on the Raw button at the top right and then save the content), edit config.json to fit your needs, if you are using it to run the Event Fabric sensors dashboard then don't change the topic in config.json unless you want to change it in the dashboard too.