Skip to content

Instantly share code, notes, and snippets.

View josemarcosrf's full-sized avatar
🏔️
Working from a mountain top

Jose Marcos RF josemarcosrf

🏔️
Working from a mountain top
View GitHub Profile
@alexlee-gk
alexlee-gk / configure_cuda_p70.md
Last active March 19, 2024 17:47
Use integrated graphics for display and NVIDIA GPU for CUDA on Ubuntu 14.04

This was tested on a ThinkPad P70 laptop with an Intel integrated graphics and an NVIDIA GPU:

lspci | egrep 'VGA|3D'
00:02.0 VGA compatible controller: Intel Corporation Device 191b (rev 06)
01:00.0 VGA compatible controller: NVIDIA Corporation GM204GLM [Quadro M3000M] (rev a1)

A reason to use the integrated graphics for display is if installing the NVIDIA drivers causes the display to stop working properly. In my case, Ubuntu would get stuck in a login loop after installing the NVIDIA drivers. This happened regardless if I installed the drivers from the "Additional Drivers" tab in "System Settings" or the ppa:graphics-drivers/ppa in the command-line.

@dswah
dswah / layers_tied.py
Last active September 17, 2021 22:45
Tied Convolutional Weights with Keras for CNN Auto-encoders
from keras import backend as K
from keras import activations, initializations, regularizers, constraints
from keras.engine import Layer, InputSpec
from keras.utils.np_utils import conv_output_length
from keras.layers import Convolution1D, Convolution2D
import tensorflow as tf
class Convolution1D_tied(Layer):
'''Convolution operator for filtering neighborhoods of one-dimensional inputs.
When using this layer as the first layer in a model,
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@pavgup
pavgup / PrintPOSTandGET.py
Created April 23, 2014 15:47
This stands up a python http server and receives both POST and GET requests and prints to the console the parameters and values it receives over HTTP. This runs on port 9000 and binds 0.0.0.0, so be careful about firewall settings when testing this.
import BaseHTTPServer
import urlparse
class SimpleHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
if "?" in self.path:
for key,value in dict(urlparse.parse_qsl(self.path.split("?")[1], True)).items():
print key + " = " + value