Skip to content

Instantly share code, notes, and snippets.

View keon's full-sized avatar

Keon keon

View GitHub Profile
keon / gist:02d73c6e3b0b1efa46f37ec50e974535
Last active July 28, 2023 09:51
custom connect button
View gist:02d73c6e3b0b1efa46f37ec50e974535
import { ChevronDown, Loader2 } from "lucide-react";
import { useEffect, useState } from "react";
import { useConnectionStatus } from "../../hooks/use-connection-status";
import { useEmojiAvatar } from "../../utils/avatars";
import { AsyncImage } from "../common/async-image";
import { PassComponent } from "../common/pass-component";
import { Button } from "../primitives/button";
import { useChains } from "../providers/chain-context";
import { ConnectButtonRenderer } from "./renderer";
keon / json
Created May 8, 2023 14:57
View json
"letters": [
"key": "q"
"key": "w"
"key": "e"
View differential-evolution.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def get_layer_output(model, layer, x):
layer_output = None
def layer_output_hook(m, i, o):
layer_output = o.clone()
hook = layer.register_forward_hook(layer_output_hook)
_ = model(x) # call forward hook
return layer_output
keon /
Created January 4, 2018 09:02
unsort pytorch
x = torch.randn(10)
y, ind = torch.sort(x, 0)
print("y", y)
print("ind", ind)
unsorted =*y.size())
unsorted.scatter_(0, ind, y)
print("unsorted:", unsorted)
print((x - unsorted).abs().max())
keon /
Last active April 7, 2019 08:40
basic mini encoder decoder model that translates 'hello' to 'hola'
# coding: utf-8
Seq2Seq (Encoder-Decoder) Model
this model is the basic encoder decoder model without attention mechanism.
author: Keon Kim
import numpy as np
import torch as th
import torch.nn as nn
View topsort.cpp
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <stack>
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
keon /
Created February 18, 2017 11:46
# -*- coding: utf-8 -*-
import random
import gym
import numpy as np
from collections import deque
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import RMSprop
View FenwickTree.cpp
class Fenwick{
const int maxN = 10000;
int table[maxN];
int sumQuery(int a, int b){
return sumQuery(b) - sumQuery(a-1);
keon /
Created February 4, 2017 11:24 — forked from tambetm/

Used dueling network architecture with Q-learning, as outlined in this paper:

Dueling Network Architectures for Deep Reinforcement Learning
Ziyu Wang, Tom Schaul, Matteo Hessel, Hado van Hasselt, Marc Lanctot, Nando de Freitas

Command line:

python CartPole-v0 --gamma 0.995