Skip to content

Instantly share code, notes, and snippets.

View robotsorcerer's full-sized avatar
🙂

Lekan robotsorcerer

🙂
View GitHub Profile
@chirag1992m
chirag1992m / weight_transfer.py
Created December 1, 2017 21:36
weight_transfer
import numpy as np
import torch
import keras
def pyt_to_keras(pytorch_model, keras_model):
"""
Given a PyTorch model, this method transfers the weight to
a Keras Model (with backend TensorFlow) with the same architecture.
Assumptions:
1. The corresponding layer names in both the models will be the same
@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
@ruffsl
ruffsl / Dockerfile
Last active February 28, 2024 23:49
Small ROS Network Example
FROM ros:indigo-ros-base
# install ros tutorials packages
RUN apt-get update && apt-get install -y \
ros-indigo-ros-tutorials \
ros-indigo-common-tutorials \
&& rm -rf /var/lib/apt/lists/
@awesomebytes
awesomebytes / Malformed_STL_fix.md
Last active August 1, 2023 05:11
How to fix a malformed stl (says Rviz)

Fix malformed stl (says Rviz)

To correct:

The STL file 'package://wsg_50_simulation/meshes/WSG-FMF.stl' is malformed. It starts with the word 'solid', indicating that it's an ASCII STL file, but it does not contain the word 'endsolid' soit is either a malformed ASCII STL file or it is actually a binary STL file. Trying to interpret it as a binary STL file instead.

When launching Rviz with a URDF containing SolidWorks created meshes in STL.

Just go to the folder with STL's with this problem and do:

@bitjockey42
bitjockey42 / install.md
Created August 7, 2015 19:40
Install SIP and PyQT4 (pyenv, pyenv-virtualenv)

Download

pyenv virtualenv

Switch to the Python version you want to use:

@karpathy
karpathy / min-char-rnn.py
Last active May 17, 2024 12:51
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@karpathy
karpathy / gist:7bae8033dcf5ca2630ba
Created May 5, 2015 07:31
Efficient LSTM cell in Torch
--[[
Efficient LSTM in Torch using nngraph library. This code was optimized
by Justin Johnson (@jcjohnson) based on the trick of batching up the
LSTM GEMMs, as also seen in my efficient Python LSTM gist.
--]]
function LSTM.fast_lstm(input_size, rnn_size)
local x = nn.Identity()()
local prev_c = nn.Identity()()
local prev_h = nn.Identity()()
@jvenator
jvenator / gist:9672772a631c117da151
Last active April 28, 2024 01:09
PDFtk Server Install Workaround for Mac OS X

Installing PDFtk Server edittion on your Mac

This workaround install is necessary because PDFtk was pulled from homebrew-cask due to issues with it aggressively overwriting file permissions that could impact other installed libraries. See this homebrew-cask issue.
The following steps worked on Mac OS X 10.10.1 with a standard brew installation for the PDFtk Mac OS X server libary version 2.02.
All Terminal commands separated by a full line space. Some commands wrap into multiple lines.

Download and extract the Mac OS X server install pacakge

@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@mgechev
mgechev / binary-search-tree-cpp.cpp
Last active October 3, 2022 03:54
Simple implementation of binary search tree in C++.
#include <iostream>
#include <math.h>
using namespace std;
template <class T>
struct Node {
T value;
Node *left;
Node *right;