Skip to content

Instantly share code, notes, and snippets.

View virae's full-sized avatar

Michal Šimonfy virae

View GitHub Profile
@virae
virae / plain_chatgpt_client.rb
Created June 9, 2023 11:37 — forked from lingceng/plain_chatgpt_client.rb
Ruby chatgpt chat api when stream mode, deal with error handle and chunk break.
class Chatgpt::PlainChatgptClient
def self.chat(parameters)
@client ||= generate_client
res = @client.post("/v1/chat/completions") do |req|
if parameters[:stream].is_a?(Proc)
req.options.on_data = to_json_stream(user_proc: parameters[:stream])
parameters[:stream] = true
end
@virae
virae / Dockerfile
Created January 9, 2023 10:02
Supercronic docker
...
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.1/supercronic-linux-amd64 \
SUPERCRONIC=supercronic-linux-amd64 \
SUPERCRONIC_SHA1SUM=d7f4c0886eb85249ad05ed592902fa6865bb9d70
RUN curl -fsSLO "$SUPERCRONIC_URL" \
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \
&& chmod +x "$SUPERCRONIC" \
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \

Keybase proof

I hereby claim:

  • I am virae on github.
  • I am virae (https://keybase.io/virae) on keybase.
  • I have a public key ASCG9Xh8G-6PEWJsaEp-4Ey05mny9YycG_pJobo9TEsKqgo

To claim this, I am signing this object:

@virae
virae / gist:2318002
Created April 6, 2012 07:53 — forked from padolsey/gist:527683
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@virae
virae / gist:2317955
Created April 6, 2012 07:37
HTML: Template with jQuery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="">
<meta name="description" content="">
<base href="">