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
def arrowed_spines(fig, ax, remove_ticks=False): | |
""" | |
좌표축 화살표를 그리기 위한 함수 | |
https://stackoverflow.com/questions/33737736/matplotlib-axis-arrow-tip | |
""" | |
xmin, xmax = ax.get_xlim() | |
ymin, ymax = ax.get_ylim() | |
# removing the default axis on all sides: | |
for side in ['bottom','right','top','left']: |
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 numpy as np | |
# 활성화 함수와 그 도함수 | |
def sigmoid(x): | |
return 1 / (1 + np.exp(-x)) | |
def sigmoid_derivative(x): | |
return x * (1 - x) | |
# 학습 데이터 (하나의 샘플) |
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
/** | |
* 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
# /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
#요기 /etc/httpd/conf/httpd.conf | |
LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi-py34.cpython-34m.so | |
WSGIPythonPath /opt/projectname:/opt/venv/lib/python3.4/site-packages | |
<VirtualHost *:80> | |
ServerName www.yourserver.com | |
DocumentRoot /opt/projectname |
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
*filter | |
# 이렇게 다 열려있는 iptable이 무슨 소용이 있으리오만. | |
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0 | |
-A INPUT -i lo -j ACCEPT | |
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT | |
# Accepts all established inbound connections | |
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT |
NewerOlder