Skip to content

Instantly share code, notes, and snippets.

View shouldsee's full-sized avatar
👀

shouldsee

👀
View GitHub Profile
@shouldsee
shouldsee / pg-pong.py
Created June 1, 2017 10:51 — forked from karpathy/pg-pong.py
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
@shouldsee
shouldsee / pattern_count-demo.py
Last active August 10, 2017 23:30
Simple for-loop comparison
#### Pattern count
#### A simple demo of for-loop and logic
#### From https://stackoverflow.com/questions/26703321/python-pattern-count-find-a-hidden-message-in-the-replication-origin
#### Save this text in a file named "demo.py" and issue in command line " python demo.py ", this script is compatible with python2 only.
#### Check your python version with " python --version "
def pattern_count(text, pattern):
count = 0
for i in range(0, len(text) - len(pattern) + 1):
@shouldsee
shouldsee / affg.ipynb
Created October 6, 2017 14:24
visualise blosum matrix
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shouldsee
shouldsee / init.jl
Last active March 20, 2018 19:43
setting up a julia env
# Pkg.clone("https://github.com/JuliaLang/Pkg3.jl.git")
PKG = [
"IJulia",
"Combinatorics",
"Plots",
"TaylorSeries",
"Distributions",
"Cubature",
"Playground"]
Pkg.add.(PKG)
@shouldsee
shouldsee / tfp_transformed_distribution.py
Last active September 2, 2018 10:23
shape overriding in TransformedDistribution() for tfp
'''
#### simple = True enables overriding behaviour
#### modifed from tensorflow_probability == 0.3.0
'''
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@shouldsee
shouldsee / joint_dist.py
Last active September 2, 2018 12:32
A Distribution() represnting the joint of [dist1,dist2,...]
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@shouldsee
shouldsee / radial_transform_minimal.py
Created September 8, 2018 14:06
Transform a distribution on R^+ to distribution on R^D with radially symmetry
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@shouldsee
shouldsee / docker-compose-systemd-unit.md
Last active October 7, 2022 08:29 — forked from mosquito/README.md
Add doker-compose as a systemd unit

Docker compose as a systemd unit

CANGELOG

  • 20221007: calls with -f to place all compose.yml in the same directory.

Content

Create file /etc/systemd/system/docker-compose@.service. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

@shouldsee
shouldsee / dist_dummy.py
Created May 9, 2023 21:23
tensorflow_probability.distribution.DummyDistribution that always output probability 1
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,