Skip to content

Instantly share code, notes, and snippets.

View likejazz's full-sized avatar

Sang Park likejazz

View GitHub Profile
@likejazz
likejazz / curl.sh
Created January 8, 2024 04:44
trlX + pipeline
$ curl -X PUT http://XXX.XXX.XXX.XXX:XXXX/ \
-H 'Content-Type: application/json' \
-d '{"prompt": "this movie was sucks!"}' | jq
@likejazz
likejazz / interface.ini
Last active January 10, 2024 04:37
nvtop configuration.
; ~/.config/nvtop/interface.ini
; Please do not edit this file.
; The file is automatically generated and modified by nvtop by pressing F12.
; If you wish to modify an option, use nvtop's setup window (F2) and follow up by saving the preference (F12).
[GeneralOption]
UseColor = true
UpdateInterval = 1000
ShowInfoMessages = true
[HeaderOption]
CONTAINER_ID=$(docker ps --format '{{.Names}}')
docker exec $CONTAINER_ID /usr/sbin/service ssh start
@likejazz
likejazz / hello.ts
Created May 4, 2021 02:47
Hello, Deno
import { serve } from "https://deno.land/std@0.95.0/http/server.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
req.respond({ body: "Hello World\n" });
}
@likejazz
likejazz / detect-faces.go
Last active January 29, 2021 02:15
Detect Faces from the Google Vision API
// References: https://cloud.google.com/vision/docs/detecting-faces#vision_face_detection_gcs-drest
package main
import (
vision "cloud.google.com/go/vision/apiv1"
"fmt"
"golang.org/x/net/context"
"google.golang.org/api/option"
pb "google.golang.org/genproto/googleapis/cloud/vision/v1"
"io"
@likejazz
likejazz / Dockefile
Last active September 26, 2020 03:41
Apache Hello World Docker
FROM ubuntu:18.04
# Install dependencies
RUN apt-get update && \
apt-get -y install apache2
# Install apache and write hello world message
RUN echo 'Hello World!' > /var/www/html/index.html
# Configure apache
@likejazz
likejazz / bigquery.py
Last active September 26, 2020 03:42
Call BigQuery API from Python
import google.auth
from google.cloud import bigquery
from google.cloud import bigquery_storage_v1beta1
# Explicitly create a credentials object. This allows you to use the same
# credentials for both the BigQuery and BigQuery Storage clients, avoiding
# unnecessary API calls to fetch duplicate authentication tokens.
def bigquery_auth(project_id: str = 'edith-xxx') -> None:
logging.info('[AUTH] Create a credentials.')
declare TARGET="ec2-XXXX.ap-northeast-2.compute.amazonaws.com"
readonly VERSION=$(date '+%y.%m.%d') # Today's yy.mm.dd ubuntu version style.
readonly IMAGE_NAME=edith/edith-XXXX
readonly ECR_REGISTRY=09960362XXXX.dkr.ecr.ap-northeast-2.amazonaws.com/edith/edith-XXXX
readonly AWS_OTP=$(aws ecr get-login-password --region ap-northeast-2)
# Build
docker build -t ${IMAGE_NAME} .
# %%
import json
datas = []
# Process KorQuAD's training data.
# Counts: 60,407
for i in range(0, 1):
in_file = '/Users/likejazz/Desktop/korquad'
# in_file += '/korquad2.0_train_0' + str(i) + '.json'
@likejazz
likejazz / ping-redis.py
Created July 6, 2019 06:56
Analyzing Redis PING performance
import time
import redis
for i in range(10):
start_time = time.time()
try:
conn = redis.StrictRedis(
host='xxx',
port=6379,
db=0)