Skip to content

Instantly share code, notes, and snippets.

View sharavsambuu's full-sized avatar
🐌

sharavsambuu sharavsambuu

🐌
View GitHub Profile
@sharavsambuu
sharavsambuu / textured_tri.py
Created December 29, 2018 23:16 — forked from binarycrusader/textured_tri.py
pysdl2 pyopengl "modern" opengl textured triangle example
#!/usr/bin/python2.7
"""Quick hack of 'modern' OpenGL example using pysdl2 and pyopengl
that shows a textured triangle; assumes there is a 'hazard.png' image
file in working directory.
Based on:
pysdl2 OpenGL example
http://www.tomdalling.com/blog/modern-opengl/02-textures/
http://www.arcsynthesis.org/gltut/Basics/Tut02%20Vertex%20Attributes.html
#!/usr/bin/python2.7
"""Quick hack of 'modern' OpenGL example using pysdl2 and pyopengl
Based on
pysdl2 OpenGL example
http://www.arcsynthesis.org/gltut/Basics/Tut02%20Vertex%20Attributes.html
http://schi.iteye.com/blog/1969710
"""
import sys
@sharavsambuu
sharavsambuu / gist:a7c3f5a3142ceabdcd1cb491a3bd3c17
Last active December 16, 2018 07:56 — forked from fschr/main.cpp
SDL2 Hello World | SDL2 Getting Started | SDL | OpenGL
// SDL2 Hello, World!
// This should display a white screen for 2 seconds
//
// sudo apt install libsdl2-dev
// sudo apt install clang
//
// clang main.c -o hello_sdl2_clang -lSDL2
// clang++ main.cpp -o hello_sdl2_clangpp -lSDL2
// gcc main.c -o hello_sdl2_gcc -lSDL2
// g++ main.cpp -o hello_sdl2_gpp -lSDL2
@sharavsambuu
sharavsambuu / cuda_installation_on_ubuntu_18.04
Created December 16, 2018 06:40 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
cuda 9.0 complete installation procedure for ubuntu 18.04 LTS
#!/bin/bash
## This gist contains step by step instructions to install cuda v9.0 and cudnn 7.2 in ubuntu 18.04
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
@sharavsambuu
sharavsambuu / PG.py
Created November 10, 2018 02:55 — forked from MikeOuimet/PG.py
Vanilla policy gradient with tensorflow
import numpy as np
import gym
import tensorflow as tf
import matplotlib.pyplot as plt
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
@sharavsambuu
sharavsambuu / beamsearch_decoder.py
Created July 9, 2018 13:57 — forked from chao-ji/beamsearch_decoder.py
Easy to understand implementation of beam search algorithm used in decoder of seq2seq models
"""
Easy-to-understand implementation of Beam Search algorithm used in decoder of
seq2seq models (e.g. NMT). Results compared with tensorflow implementation
(1.5.0) (`tf.contrib.seq2seq.BeamSearchDecoder`)
"""
import tensorflow as tf
import numpy as np
import heapq
import collections
brew install autoconf automake libtool protobuf
git clone --depth=1 https://github.com/google/sentencepiece.git /tmp/sentencepiece
cd /tmp/sentencepiece
./autogen.sh
./configure
make
make check
sudo make install
@sharavsambuu
sharavsambuu / Matrix.md
Created May 27, 2018 18:43 — forked from nadavrot/Matrix.md
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@sharavsambuu
sharavsambuu / CartPole-REINFORCE-MCMC.py
Created May 5, 2018 03:40 — forked from Adriel-M/CartPole-REINFORCE-MCMC.py
REINFORCE: Monte Carlo Policy Gradient solution to Cartpole-v0 with a hidden layer.
# REINFORCE: Monte Carlo Policy Gradient Implementation
# Learn more from Reinforcement Learning: An Introduction (p271)
# by Sutton & Barto
import tensorflow as tf
import gym
import numpy as np
from gym import wrappers
@sharavsambuu
sharavsambuu / smallpt_tf.py
Created May 5, 2018 02:31
small pathtracer implemented by using tensorflow
# coding: utf-8
"""
シンプルなパストレーサー
cf. http://www.kevinbeason.com/smallpt/
"""
import shutil
import numpy as np
import tensorflow as tf