Skip to content

Instantly share code, notes, and snippets.

View EndingCredits's full-sized avatar

William Woof EndingCredits

View GitHub Profile
@EndingCredits
EndingCredits / Mopidy Pi
Last active December 8, 2022 22:23
Setting up mopidy and MPD/http clients
Install mopidy: ##N.B: You might need to do this as per instructions on `https://docs.mopidy.com/en/latest/installation/debian/`
`sudo apt-get update && sudo apt-get install mopidy`
Set the mopidy to run automatically via `sudo systemctl enable mopidy`
Now we need to set up configuration files.
Since we're going to be running mopidy as a service, we need to edit `/etc/mopidy/mopidy.conf`(see https://docs.mopidy.com/en/latest/service/#service)
Add the following to to configuration file:
@EndingCredits
EndingCredits / adamirror.py
Last active November 14, 2019 09:26
Quick and dirty tensorflow implementation of Optimistic Mirror Descent for the Adam Optimiser as in https://arxiv.org/abs/1711.00141
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import state_ops
from tensorflow.python.framework import ops
from tensorflow.python.training import optimizer
import tensorflow as tf
@EndingCredits
EndingCredits / FCN.py
Last active January 23, 2018 15:49
Modification of fully connected networks
from __future__ import print_function
import tensorflow as tf
import numpy as np
from glob import glob
import os
import TensorflowUtils as utils
import read_MITSceneParsingData as scene_parsing
import datetime
@EndingCredits
EndingCredits / build_dataset.py
Created January 23, 2018 14:22
Builds lung dataset from mat file
import scipy.io as sio
import numpy as np
import scipy.misc
mat_contents = sio.loadmat('LungTrainingData.mat')
#matrix is of the form [x,y,n]
#['CT2', 'Right2', 'Left2', '__header__', '__globals__', '__version__', 'Trachea2']
images = mat_contents['CT2']
left_lung = mat_contents['Left2']
import glob
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = plt.subplot(111)
def savitzky_golay(y, window_size, order, deriv=0, rate=1):
@EndingCredits
EndingCredits / tf_ls_gradients_test.py
Created May 11, 2018 12:40
Demonstration of backprop through tf.matrix_solve_ls to learn features for random data
from __future__ import division
import numpy as np
import tensorflow as tf
# Launch the graph
config = tf.ConfigProto()
config.gpu_options.allow_growth=True
with tf.Session(config=config) as sess:
NUM_EXAMPLES = 8096
def combine_weights(in_list):
"""
Returns a 1D tensor of the input list of (nested lists of) tensors, useful
for doing things like comparing current weights with old weights for EWC.
1.) For all elements in input list, (ln 3)
if a list combine it recursively
else leave it alone
2.) From resulting list, get all non-none elements and flatten them (ln 2)
3.) If resulting list is empty return None (ln 1)
@EndingCredits
EndingCredits / DynBoneCopy.cs
Created May 26, 2018 13:04
Script to copy dynamic bones to multiple objects
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[ExecuteInEditMode]
public class DynBoneCopy : MonoBehaviour {
public DynamicBone template;
public bool Make_Permenant;
import numpy as np
import tensorflow as tf
"""
# Generate some random data
# data = n x m, n = num examples, m = number features
# labels = n x c, n = num examples, c = number classes
"""
KARPATHY_CONST = 0.00025
========================================
A simple solution
========================================
How To Make Your Own VR Headset
First, let's start with the basics. It's not a bad idea to make your own headset. The best way to make it is to buy an Oculus Rift.
========================================