This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
##################################################### | |
# Name: Bash CheatSheet for Mac OSX | |
# | |
# A little overlook of the Bash basics | |
# | |
# Usage: | |
# | |
# Author: J. Le Coupanec | |
# Date: 2014/11/04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.cm as cm | |
from blessed import Terminal | |
def print_dist(prob,cmap=cm.gray): | |
term = Terminal() | |
for i_list in prob.tolist(): | |
result ="" | |
for i in i_list: | |
r,g,b,a = cmap(i,bytes=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
def load_gist(gist_id): | |
"""translate Gist ID to URL""" | |
from json import load | |
from urllib.request import Request, urlopen | |
gist_api = urlopen("https://api.github.com/gists/" + gist_id) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datasets | |
from datasets import Value,Sequence,Features | |
def dict_generator(indict): | |
if isinstance(indict,str): | |
return datasets.Value("string") | |
elif isinstance(indict,int): | |
return datasets.Value("int32") | |
elif isinstance(indict,float): | |
return datasets.Value("float32") | |
elif isinstance(indict,list): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: `killgpu 0` will kill all the processes that are using gpu 0 | |
killgpu (){ | |
# https://forums.developer.nvidia.com/t/11-gb-of-gpu-ram-used-and-no-process-listed-by-nvidia-smi/44459/14 | |
fuser -v /dev/nvidia$@ 2>&1 | grep python | grep -o -E " [0-9]+ " | xargs kill -9 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
analog_keys = {0:0, 1:0, 2:0, 3:0, 5:0} | |
import numpy as np | |
# START OF GAME LOOP | |
while running: | |
state = np.array(mycobot.get_angles()) | |
if len(state)!=6: | |
state = np.zeros(6) | |
################################# CHECK PLAYER INPUT ################################# | |
for event in pygame.event.get(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hf_features_to_tf_features(features): | |
output_types= {} | |
output_shapes = {} | |
for x,y in features.items(): | |
output_types[x] = getattr(tf.dtypes,y.dtype) if y.dtype!="list" else getattr(tf.dtypes,y.feature.dtype) | |
output_shapes[x] = [] if y.dtype!="list" else [None] | |
return dict(output_types=output_types,output_shapes=output_shapes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transitions import Machine | |
import random | |
import numpy as np | |
class RobotModel(object): | |
# Define some states. Most of the time, narcoleptic superheroes are just like | |
# everyone else. Except for... | |
states = ['LeftY', 'LeftN', 'MidY', 'MidN', 'RightY','RightN'] | |
def __init__(self): |
OlderNewer