Skip to content

Instantly share code, notes, and snippets.

View davidrpugh's full-sized avatar

David R. Pugh davidrpugh

  • King Abdullah University of Science and Technology
  • Thuwal, Saudi Arabia
  • 10:00 (UTC +03:00)
  • X @davidrpugh_
View GitHub Profile
@davidrpugh
davidrpugh / simple_agent_simulation.py
Last active June 14, 2020 19:38
Simple simulation of remote rendering in using a virtual display
import typing
import gym
import matplotlib.pyplot as plt
import numpy as np
from IPython import display
# represent states as arrays and actions as ints
State = np.ndarray
@davidrpugh
davidrpugh / starting_pyvirtualdisplay.py
Created May 7, 2020 10:52
How to start an Xvfb virtual display using pyvirtualdisplay
import pyvirtualdisplay
_display = pyvirtualdisplay.Display(visible=False, # use False with Xvfb
size=(1400, 900))
_ = _display.start()
@davidrpugh
davidrpugh / binary_tree.py
Created March 16, 2016 08:22
Simple implementation of a binary search tree...
class BinarySearchTree(object):
_length = 0
_root = None
class TreeNode(object):
def __init__(self, value, left_child, parent, right_child):
"""Create an instance of a TreeNode."""
from collections.abc import Sequence
class DoubleLinkedList(Sequence):
"""Simple implementation of a doubly linked list."""
_length = 0
_head = None
@davidrpugh
davidrpugh / linked_list.py
Last active March 7, 2016 07:19
Simple implementations of various linked list data structures in Python.
from collections.abc import Sequence
class LinkedList(Sequence):
"""Simple implementation of a linked list."""
_length = 0
_head = None
@davidrpugh
davidrpugh / conda_instructions.md
Last active July 25, 2021 15:21
Instructions for setting up a Conda development environment

Creating a Conda development environment

We recommend that you set up a Python environment for developing quantecon that is separate from the "default" Python environment that you use in your own research. This will allow you to contribute to quantecon without worrying about corrupting the Python environment on which your other work depends.

Below are instructions for building a separate development environment for contributing to the quantecon package using the Conda package management system which comes bundled with the Anaconda Python distribution provided by Continuum Analytics.

Step 1:

Fork and clone a copy of the quant-econ repository on to your local machine.

Step 2:

@davidrpugh
davidrpugh / gist:5426242
Created April 20, 2013 14:53
Model file for solving a basic RBC model using Dynare++
/////////////// Basic RBC model ///////////////
////////// Declare variables //////////
///// Endogenous variables /////
/* List of variables:
k: capital
c: consumption