Skip to content

Instantly share code, notes, and snippets.

View cocomoff's full-sized avatar
🏠
Working from home

Keisuke OTAKI cocomoff

🏠
Working from home
View GitHub Profile
{"version": 1, "width": 24, "height": 9, "duration": 5.5, "command": "-", "title": "gym VideoRecorder episode", "env": {}, "stdout": [[0.5, "\u001b[2J\u001b[1;1H+---------+\r\n|R: | : :\u001b[34;1mG\u001b[0m|\r\n|\u001b[43m \u001b[0m: : : : |\r\n| : : : : |\r\n| | : | : |\r\n|Y| : |\u001b[35mB\u001b[0m: |\r\n+---------+\r\n\r\n"], [0.5, "\u001b[2J\u001b[1;1H+---------+\r\n|R: | : :\u001b[34;1mG\u001b[0m|\r\n|\u001b[43m \u001b[0m: : : : |\r\n| : : : : |\r\n| | : | : |\r\n|Y| : |\u001b[35mB\u001b[0m: |\r\n+---------+\r\n (Pickup)\r\n"], [0.5, "\u001b[2J\u001b[1;1H+---------+\r\n|R: | : :\u001b[34;1mG\u001b[0m|\r\n|\u001b[43m \u001b[0m: : : : |\r\n| : : : : |\r\n| | : | : |\r\n|Y| : |\u001b[35mB\u001b[0m: |\r\n+---------+\r\n (Dropoff)\r\n"], [0.5, "\u001b[2J\u001b[1;1H+---------+\r\n|R: | : :\u001b[34;1mG\u001b[0m|\r\n| : : : : |\r\n|\u001b[43m \u001b[0m: : : : |\r\n| | : | : |\r\n|Y| : |\u001b[35mB\u001b[0m: |\r\n+---------+\r\n (South)\r\n"], [0.5, "\u001b[2J\u001b[1;1H+---------+\r\n|R: | : :\u001b[34;1mG
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import seaborn as sns
def draw_flame(N=10, M=10):
X = np.zeros((N, M))
@cocomoff
cocomoff / seg7dec.v
Created April 12, 2018 14:09
7seg decode
module seg7dec (
input [3:0] DIN,
output reg [6:0] HEX
);
always @* begin
case ( DIN )
4'h0: HEX = 7'b1000000;
4'h1: HEX = 7'b1111001;
4'h2: HEX = 7'b0100100;
@cocomoff
cocomoff / main.py
Created May 13, 2018 05:11
I2C display for RPI 2 (model B+)
# -*- coding: utf-8 -*-
# original soruce: https://terutakke.com/diary/1602-i2c-serial-lcd-modul/
from time import sleep
from time import gmtime, strftime
import RPi.GPIO as GPIO
import datetime
import smbus
@cocomoff
cocomoff / parser.py
Created May 29, 2018 13:45
Naive OSM file parser
# -*- coding: utf-8 -*-
import pickle
import networkx as nx
from lxml import etree
from copy import deepcopy
filename = 'hiroshima.osm'
tree = etree.parse(filename)
G = nx.DiGraph()
@cocomoff
cocomoff / plot.py
Created May 29, 2018 13:48
Naive OSM parsed pickle plot viewer
# -*- coding: utf-8 -*-
import pickle
import networkx as nx
import matplotlib.pyplot as plt
G = pickle.load(open("GG.pickle", "rb"))
print(G.number_of_nodes())
print(G.number_of_edges())
@cocomoff
cocomoff / sample_bipartite.py
Created September 4, 2018 13:45
Bipartite graphs in networkx
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import networkx as nx
from networkx.algorithms import bipartite
B = nx.Graph()
B.add_nodes_from([1, 2, 3, 4], bipartite=0)
B.add_nodes_from(['a', 'b', 'c'], bipartite=1)
B.add_edges_from([
@cocomoff
cocomoff / tekitou_shortest_paths.py
Created November 6, 2018 14:31
tekitou shortest paths
# *-* coding: utf-8 -*-
import time
import numpy as np
import networkx as nx
from itertools import product
from collections import defaultdict
from generator.sample_graph import grid_graph_noisy
def build_stpath_functions(G):
@cocomoff
cocomoff / tekitou_shortest_paths.py
Created November 6, 2018 14:31
tekitou shortest paths
# *-* coding: utf-8 -*-
import time
import numpy as np
import networkx as nx
from itertools import product
from collections import defaultdict
from generator.sample_graph import grid_graph_noisy
def build_stpath_functions(G):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.