This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import pipeline | |
generator = pipeline('text-generation', model = 'beomi/llama-2-ko-7b') | |
print("===========") | |
a = generator( | |
"""### System: | |
You are Free Willy, an AI that follows instructions extremely well. | |
Help as much as you can. | |
Remember, be safe, and don't do anything illegal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Working config for auth_request with proxy_cache. (nginx 1.18.0) | |
# https://gist.github.com/jinto/f120e497db8d39d866db49ff2454b7b3 | |
# ... | |
proxy_cache_path /tmp/cache_xx levels=1:2 keys_zone=auth_cache:10m max_size=128m inactive=10m use_temp_path=off; | |
server { | |
location / { | |
auth_request /_ml_proxy/auth; | |
# ... | |
proxy_pass http://backend_ip:7860/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/nginx/sites-enabled/site-domain | |
upstream backend { | |
server 127.0.0.1:7777 weight=100 max_fails=5 fail_timeout=5; | |
server 127.0.0.1:7778 weight=100 max_fails=5 fail_timeout=5; | |
} | |
server { | |
listen 80; | |
server_name www.xxx.com; | |
return 301 http://xxx.com$request_uri; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
require "bunny" | |
def hi(name) | |
conn = Bunny.new(:automatically_recover => false) | |
conn.start | |
ch = conn.create_channel(nil, 8) | |
q = ch.queue(name)#, :exclusive => true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* With java8 lambda you can use JDBC like | |
* | |
* return select("SELECT fields from table_name where id=?", (params)-> { | |
* params.add("user_id"); | |
* }); | |
* | |
*/ | |
import java.util.List; | |
import java.util.ArrayList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# problem is code duplication. | |
from django.db import connections | |
class Dao: | |
@classmethod | |
def get_list(cls): | |
try: | |
conn = connections["db_name"] | |
cursor = conn.cursor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 현재 가장 잘 동작하는 버전인듯 | |
# postgres는 설치했다고 가정하자. | |
# Some good references are: | |
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x | |
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/ | |
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392 | |
# 환경변수에 LC_COLLATE=C 이거 있는지 확인 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grapes([ | |
@Grab(group='postgresql', module='postgresql', version='8.4-701.jdbc4'), | |
@GrabConfig(systemClassLoader = true) | |
]) | |
import groovy.sql.Sql | |
def sql = Sql.newInstance("jdbc:postgresql://localhost/ebsa_dev", "jinto", "", "org.postgresql.Driver") | |
i = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.sun.net.httpserver.*; | |
HttpServer server = HttpServer.create(new InetSocketAddress(2222),0) | |
server.createContext('/', { HttpExchange exchange -> | |
exchange.sendResponseHeaders(200,0); | |
exchange.responseBody.write("hello from groovy land.".bytes) | |
exchange.responseBody.close(); | |
i++; | |
} as HttpHandler) | |
server.start(); |
NewerOlder