Skip to content

Instantly share code, notes, and snippets.

View kairess's full-sized avatar

Brad kairess

View GitHub Profile
@kairess
kairess / chatgpt-twochat.js
Created January 30, 2023 13:47
Two ChatGPT talking to each other
//Reference: https://github.com/hnasr/javascript_playground/tree/master/chatgpt-twochats
//go to chat.openai.com
//paste the following code in the console
document.body.removeChild(document.body.firstChild)
document.body.innerHTML = `<table>
<tr>
<td><iframe style = 'width:600px;height:1200px' id = 'cf1' src = 'https://chat.openai.com/chat/36327d80-e9a4-4cd2-a4e7-4323cf4f05c8'></iframe></td>
<td><iframe style = 'width:600px;height:1200px' id = 'cf2' src = 'https://chat.openai.com/chat/1aa8ab10-2e0a-4856-8d83-7b77a4471567'></iframe></td>
from dynamikontrol import Module
module = Module()
module.motor.speed(1000)
from dynamikontrol import Module
module = Module()
module.motor.angle(45)
@kairess
kairess / static_server.js
Created May 23, 2019 06:25 — forked from amejiarosario/static_server.js
Node.js quick file server (static files over HTTP) using es6+
const http = require('http');
const url = require('url');
const fs = require('fs');
const path = require('path');
const port = process.argv[2] || 9000;
http.createServer(function (req, res) {
console.log(`${req.method} ${req.url}`);
// parse URL
@kairess
kairess / lcnn29_keras.py
Last active December 17, 2018 14:23
Light CNN 29 for Keras (Original code for pytorch, https://github.com/AlfredXiangWu/LightCNN)
def conv2d_bn(x, filters, kernel_size, strides=1, padding='same', activation='relu', use_bias=False, name=None):
x = Conv2D(filters, kernel_size, strides=strides, padding=padding, use_bias=use_bias, kernel_initializer='he_normal', name=name)(x)
if not use_bias:
bn_axis = 1 if K.image_data_format() == 'channels_first' else 3
bn_name = None if name is None else name + '_bn'
x = BatchNormalization(axis=bn_axis, scale=False, name=bn_name)(x)
return x
def mfm(x):
shape = K.int_shape(x)
@kairess
kairess / mnist_keras.py
Created November 23, 2017 12:08
MNIST mini batch optimization for Keras, early stopping and save model checkpoint applied.
from __future__ import print_function
import keras
import os
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras import backend as K
from keras.models import load_model
// 1. PiPeClientTest.dll 파일 추가
#pragma comment(lib,"VREX_WIN.lib")
// 2. 헤더 파일 추가
#include "VREX.h"
using namespace std;
// 3. Gaze Point를 받는 콜백함수 작성
void getGazePt(float x, float y) {
_tprintf(_T("getGazePt %f %f \n"),x,y);
// VREX_WIN Client
// 1. 변수선언
private IntPtr client;
// x,y coord;
static float x_coord;
static float y_coord;
// UI Text Content
private static String logContent = "";
@kairess
kairess / svr.py
Created November 16, 2017 09:07
Support Vector Regression
import numpy as np
from sklearn.svm import SVR
import matplotlib.pyplot as plt
# Generate sample data
X = np.sort(5 * np.random.rand(40, 1), axis=0)
y = np.sin(X).ravel()
# Add noise to targets
y[::5] += 3 * (0.5 - np.random.rand(8))