This is a very simple HTTP server for Unix, using fork(). It's very easy to use
- include header
httpd.h - write your route method, handling requests.
- call
serve_forever("12913")to start serving on port 12913
| -- Enable pl/v8: | |
| CREATE EXTENSION plv8; | |
| -- Create json history table: | |
| CREATE TABLE json_history (id BIGSERIAL PRIMARY KEY, tstamp timestamp DEFAULT now(), table_name text, column_name text, target_id bigint, transform json); | |
| -- Create test table: | |
| CREATE TABLE test_json (id BIGSERIAL PRIMARY KEY, data JSON); | |
| -- Enable history tracking on test_json.data: |
This is a Deep Reinforcement Learning solution to some classic control problems. I've used it to solve MountainCar-v0 problem, CartPole-v0 and [CartPole-v1] (https://gym.openai.com/envs/CartPole-v1) in OpenAI's Gym. This code uses Tensorflow to model a value function for a Reinforcement Learning agent. I've run it with Tensorflow 1.0 on Python 3.5 under Windows 7.
Some of the hyperparameters used in the main.py script to solve MountainCar-v0 have been optained via Bayesian optimization with Scikit-Optimize. The optimized hyperparameters and their values are:
| /* | |
| * Verilog Simulator checker by predefined macro. | |
| * | |
| * Copyright (C) 2017 MURAMATSU Atsushi <amura@tomato.sakura.ne.jp> | |
| * | |
| * Permission is hereby granted, free of charge, to any person | |
| * obtaining a copy of this software and associated documentation files | |
| * (the "Software"), to deal in the Software without restriction, | |
| * including without limitation the rights to use, copy, modify, merge, | |
| * publish, distribute, sublicense, and/or sell copies of the Software, |
| # -*- coding: utf-8 -*- | |
| import os | |
| import numpy as np | |
| import subprocess as sp | |
| import re | |
| def polar(afile, re, *args,**kwargs): | |
| """calculate airfoil polar and load results |
| ################## | |
| ### config.yml ### | |
| ################## | |
| version: 2 | |
| jobs: | |
| build: | |
| docker: | |
| - image: circleci/python:3.6 | |
| steps: |
| `define INPUTSIZE 64 //set the input size n | |
| `define GROUPSIZE 8 //set the group size = 1, 2, 4 or 8 | |
| module Brent_Kung_Adder(A,B,S); | |
| input [`INPUTSIZE - 1:0] A; | |
| input [`INPUTSIZE - 1:0] B; | |
| output [`INPUTSIZE:0] S; | |
| wire [`INPUTSIZE / `GROUPSIZE * 2 - 1:0] r_temp; |
| repeat | |
| set chargeState to do shell script "pmset -g batt | awk '{printf \"%s %s\\n\", $4,$5;exit}'" | |
| set percentLeft to do shell script "pmset -g batt | egrep -ow '([0-9]{1,3})[%]' | egrep -ow '[0-9]{1,3}'" | |
| considering numeric strings | |
| if chargeState contains "Battery Power" and percentLeft ≤ 40 then | |
| display notification "Time to plug me in :)" with title "Battery Charge Boundary" | |
| else if chargeState contains "AC Power" and percentLeft ≥ 80 then | |
| display notification "Time to unplug me :)" with title "Battery Charge Boundary" | |
| end if | |
| end considering |