Skip to content

Instantly share code, notes, and snippets.

View nwtgck's full-sized avatar
:octocat:
Feel free to make my English natural by native speakers

Ryo Ota nwtgck

:octocat:
Feel free to make my English natural by native speakers
View GitHub Profile
@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
@arxdsilva
arxdsilva / URLvalidatorExample.go
Last active June 24, 2021 09:17
Golang - How to validate URL
import (
"fmt"
"github.com/asaskevich/govalidator"
)
// You can use as well instead of *url.URL a string with your URL, in this case you might drop `u.String()`
// - transformation to string in method call.
func validateURL(u *url.URL) error {
valid := govalidator.IsRequestURL(u.String())
if valid == false {
@gakuzzzz
gakuzzzz / sbt-coursier.md
Last active June 27, 2019 03:23
あなたの sbt update を爆速にする sbt-coursier の紹介

あなたの sbt update を爆速にする sbt-coursier の紹介

この記事は Scala Advent Calendar 2016(Adventar) 10日目の記事です。

今は 12/10 の 625時です。年明けなんて無かった。いいね?

さてさて、sbt の依存jarのダウンロードが遅い、というのは割とよく言われる事であります。

で、この原因の一旦に、sbtが Apache Ivy を使っている、という点があります。

@bowin
bowin / node.js PassThrough stream.md
Last active May 18, 2025 18:05
Node.js Stream PassThrough Usage
const {PassThrough} = require('stream')
const fs = require('fs')

const d = new PassThrough()  

fs.createReadStream('tt2.js').pipe(d)  // can be piped from reaable stream

d.pipe(process.stdout)                 // can pipe to writable stream 
d.on('data', console.log) // also like readable
@gakuzzzz
gakuzzzz / design_pattern_in_scala.md
Last active February 12, 2024 02:05
Design Patterns in Scala (ScalaMatsuri 2018 Unconfoerence)

Design Patterns in Scala

Scala でよく見るパターン

Type-Safe Builder

Javaで多引数のコンストラクタを避けるために使われる Builder パターンは、Scala では名前付き引数呼び出しが使えるので必要ありません。

Builderパターンに制約を加えて条件に合わない場合、コンパイルエラーにしたい。

@xuwei-k
xuwei-k / ScalaNativeHttpGetExample.scala
Created March 31, 2018 08:45
scala-native http get example
package example
import java.net._
import java.io._
object ScalaNativeHttpGetExample {
def using[A <: Closeable, B] (a: A)(f: A => B): B =
try {
f(a)
} finally {
@voluntas
voluntas / webrtc_data_channel.rst
Last active January 3, 2025 11:07
WebRTC DataChannel コトハジメ
import cv2
import numpy as np
#動画ファイルパス
ESC_KEY = 27 # Escキー
INTERVAL= 33 # インターバル
FRAME_RATE = 30 # fps
#ウインドウ名の定義
import numpy as np
import cv2
FILE_ORG = "calibrated_output_background2.m4v"
WINDOW_ORG = "Orginal_frame"
FRAME_RATE = 30 # fps
class LocationDetector:
def __init__(self,
PHP 10 hrs 33 mins █████████████▍░░░░░░░ 64.0%
TypeScript 2 hrs 7 mins ██▋░░░░░░░░░░░░░░░░░░ 12.9%
Smarty 2 hrs 5 mins ██▋░░░░░░░░░░░░░░░░░░ 12.7%
Nginx 25 mins ▌░░░░░░░░░░░░░░░░░░░░ 2.5%
JavaScript 20 mins ▍░░░░░░░░░░░░░░░░░░░░ 2.0%