Skip to content

Instantly share code, notes, and snippets.

View haiy's full-sized avatar

hai haiy

View GitHub Profile
@haiy
haiy / cloudflare-worker-proxy.js
Created December 17, 2023 11:19 — forked from noobnooc/cloudflare-worker-proxy.js
cloudflare-worker-proxy
// Website you intended to retrieve for users.
const upstream = 'api.openai.com'
// Custom pathname for the upstream website.
const upstream_path = '/'
// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = upstream
// Countries and regions where you wish to suspend your service.
@haiy
haiy / min-char-rnn.py
Created November 12, 2017 14:54 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@haiy
haiy / jupyter
Created October 14, 2016 18:16 — forked from jmtatsch/jupyter
A service (init.d) script for jupyter
#! /bin/sh
### BEGIN INIT INFO
# Provides: jupyter
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start jupyter
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@haiy
haiy / tmux.md
Created July 23, 2016 13:28 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@haiy
haiy / vim_cheatsheet.md
Created July 23, 2016 13:25 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@haiy
haiy / .ctags
Last active August 29, 2015 14:08 — forked from hdeshev/.ctags
1.将下面文件导入 ~/.ctags
--langdef=scala
--langmap=scala:.scala
--regex-scala=/^[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\1/c,classes/
--regex-scala=/.*trait[ \t]+([a-zA-Z0-9_]+)/\1/t,traits/
--regex-scala=/^[ \t]*sealed[ \t]+trait[ \t]+([a-zA-Z0-9_]+)/\1/t,sealed traits/
--regex-scala=/^[ \t]*type[ \t]+([a-zA-Z0-9_]+)/\1/T,types/
--regex-scala=/^[ \t]*def[ \t]+([a-zA-Z0-9_]+)/\1/m,methods/
--regex-scala=/^[ \t]*private def[ \t]+([a-zA-Z0-9_]+)/\1/m,methods/