Skip to content

Instantly share code, notes, and snippets.

View likejazz's full-sized avatar

Sang Park likejazz

View GitHub Profile
@likejazz
likejazz / long-encoded-string.cc
Last active March 31, 2024 13:38
Long Encoded String
#include <iostream>
#include <regex>
using namespace std;
int alphabet[26];
void tokenized(int a, int c) {
alphabet[a - 1] += c;
}
@likejazz
likejazz / aws-deeplearning-essential-install.sh
Last active February 28, 2024 05:26
Essential installation script for Amazon Linux 2023
#!/bin/bash
############################################
# Initialization Script for Amazon Linux 2
############################################
# Run "sudo yum update" to apply all updates.
sudo yum update -y
# Set the Timezone to KST
@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]
@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
CONTAINER_ID=$(docker ps --format '{{.Names}}')
docker exec $CONTAINER_ID /usr/sbin/service ssh start
#include <iostream>
#include <math.h>
#include <stdio.h>
// Kernel function to add the elements of two arrays
__global__
void add(int n, float *x, float *y) {
int index = blockIdx.x * blockDim.x + threadIdx.x;
int stride = blockDim.x * gridDim.x;
for (int i = index; i < n; i += stride)
@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 / 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.')
@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