Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

## Hibernating
Want to hibernate at low battery automatically. First getting hibernate to work. Created swap partition larger than RAM (8Gb) and set it up with mkswap and swapon as in [Arch Wiki](https://wiki.archlinux.org/index.php/Swap). Added kernel parameters to grub. **Problem**: didn't read the article properly and forgot to add to fstab so swap didn't stay on reboot.
Next should use udev rule to get the system to auto-hiberate at 5% or similar. [Forum post](https://bbs.archlinux.org/viewtopic.php?pid=1164408) appears to cover how to do this, but doesn't. It's in the [Laptop page](https://wiki.archlinux.org/index.php/laptop#Udev_events) of the arch wiki.
```
# Suspend the system when battery level drops to 2%
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="2", RUN+="/usr/bin/systemctl suspend"
```
@gngdb
gngdb / gist:6fd55578799d5c9bb91a
Created June 19, 2014 14:47
draft notebook extracting GO features
{
"metadata": {
"name": "",
"signature": "sha256:b23e93486e20b6aff97fda2c314462af8b5520f5d167aac630da914b91510d87"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
ctrl_interface=/var/run/wpa_supplicant
eapol_version=1
ap_scan=1
fast_reauth=1
network={
ssid="eduroam"
identity="email@address.com"
#psk="your password goes here"
# or:
@gngdb
gngdb / gist:fbf1d3eaf174cafaacf6
Created November 6, 2014 20:29
wpa2-peap-nodomain
name = WPA2-PEAP-NODOMAIN
author = atiketemola
version = 1
require identity *Username password *Password
protected password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="$_ESSID"
proto=RSN
@gngdb
gngdb / gist:eadb4c53c55b3b3fa287
Created November 7, 2014 12:53
pip error log
------------------------------------------------------------
/usr/bin/pip3 run on Fri Nov 7 12:38:03 2014
Downloading/unpacking h5py
Getting page https://pypi.python.org/simple/h5py/
URLs to search for versions for h5py:
* https://pypi.python.org/simple/h5py/
Analyzing links from page https://pypi.python.org/simple/h5py/
Skipping link https://pypi.python.org/packages/2.6/h/h5py/h5py-2.2.1.win32-py2.6.exe#md5=ce6c26dc8ef1fea864ecf286c1e4cb98 (from https://pypi.python.org/simple/h5py/); unknown archive format: .exe
Skipping link https://pypi.python.org/packages/2.6/h/h5py/h5py-2.3.0.win32-py2.6.exe#md5=23f12194da7e5fededa2e590c6531f51 (from https://pypi.python.org/simple/h5py/); unknown archive format: .exe
Skipping link https://pypi.python.org/packages/2.6/h/h5py/h5py-2.3.0b1.win32-py2.6.exe#md5=92174de66333d5ec4919d3a5bf7cb302 (from https://pypi.python.org/simple/h5py/); unknown archive format: .exe
@gngdb
gngdb / gist:0392d7ba201dd3a09189
Created January 31, 2015 19:43
PMR tutorial 1 notes
{
"metadata": {
"name": "",
"signature": "sha256:eff41c41a5ebd1edc41f0a9e68a94ac18d5b417ce2cfe2baf22d49c0f7699eb9"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@gngdb
gngdb / gist:dbcd157b917410561c72
Last active August 29, 2015 14:15
in progress notes on variational GMM
{
"metadata": {
"name": "",
"signature": "sha256:f4c2596208087783232f2bf4dbd6fc6742fa724077af8d31dee04d115c68c9f2"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@gngdb
gngdb / gist:cdab95c14f6577edfbbb
Created February 24, 2015 15:17
PMR tutorial 2 questions 4 and 5
{
"metadata": {
"name": "",
"signature": "sha256:3053e761cda6c1e5fe6f3fa5089c2cb47730ba1f8b6f525924879ecc69582c31"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@gngdb
gngdb / gist:809da9c38610ecd2f3f3
Created March 27, 2015 12:30
PMR tutorial 7 notebook
This file has been truncated, but you can view the full file.
{"nbformat_minor": 0, "cells": [{"source": "Question 2\n====\n\n> Consider a noisy oscillator given by\n> \n $$\n \\mathbf{x} = \\alpha R \\mathbf{x} + \\mathbf{\\epsilon}\n $$\n>\n> where R is a unitary rotation matrix through a small angle and epsilon is a very small isotropic Gaussian noise term.\n> Initialise at the unit vector. What happens to this system over time if $\\alpha=1$? What if $alpha < 1$? Draw an\n> example picture\n\nSo I'm not going to draw it, it's going to draw itself.\n", "cell_type": "markdown", "metadata": {}}, {"execution_count": 1, "cell_type": "code", "source": "import numpy as np\n%matplotlib inline", "outputs": [], "metadata": {"collapsed": true, "trusted": true}}, {"execution_count": 2, "cell_type": "code", "source": "# initialise unit column vector\nx = np.ones((2,1))", "outputs": [], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 3, "cell_type": "code", "source": "#define our update equation\ndef update(x, alpha, R, var_epsilon):\n return alpha*np.