Skip to content

Instantly share code, notes, and snippets.

@clonekim
clonekim / test_daemon.py
Created January 2, 2023 06:58 — forked from komasaru/test_daemon.py
Python script to do a process as a daemon.
#!/usr/local/bin/python3.6
import datetime
import sys
import traceback
from daemon import DaemonContext
from os import path
from time import sleep
from lockfile.pidlockfile import PIDLockFile
@clonekim
clonekim / svg-drag.js
Created November 18, 2021 14:45 — forked from hashrock/svg-drag.js
SVG Drag and Drop with React Hooks
import React from "react";
import ReactDOM from "react-dom";
const Circle = () => {
const [position, setPosition] = React.useState({
x: 100,
y: 100,
active: false,
offset: { }
});
@clonekim
clonekim / gem.xml
Created August 18, 2020 01:38
jOOQ/Mariadb CodeGeneration
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.13.0.xsd">
<jdbc>
<driver>org.mariadb.jdbc.Driver</driver>
<url>jdbc:mariadb://127.0.0.1:3306/redmine</url>
<user>root</user>
<password>secret</password>
<properties>
<property>
@clonekim
clonekim / SimpleJavalin.kt
Created August 12, 2020 06:43
Simple Javalin
import io.javalin.Javalin
import io.javalin.http.Context
import io.javalin.apibuilder.ApiBuilder.get
import io.javalin.apibuilder.ApiBuilder.path
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.server.ServerConnector
import org.eclipse.jetty.util.thread.QueuedThreadPool
object IndexController {
@clonekim
clonekim / lacinia-test.clj
Last active November 12, 2021 04:14
Lacinia Setup
(defmethod ig/init-key :http/graphql [_ {:keys [schema]}]
(do
(log/info "initializing schema")
(graphql/init-schema schema)))
(defmethod ig/init-key :http/server [_ {:keys [handler port]}]
(let [server (http/run-server handler {:port port})]
(log/info "Starting HTTP server on port" port)
@clonekim
clonekim / config.edn
Created August 12, 2020 01:14
Boot httpkit using integrant
{:http {:port 9090 :handler #ig/ref :handler/app}
:handler/app {}}
@clonekim
clonekim / OkHttpTest.kt
Last active August 11, 2020 04:05
OkHttp/soap consumer
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import java.io.IOException
import java.io.InputStream
import java.security.KeyStore
import java.security.KeyStoreException
import java.security.NoSuchAlgorithmException
import java.security.cert.CertificateException
@clonekim
clonekim / oauth.clj
Created July 23, 2020 03:28
OAuth2 by Clojure
(ns backend.google.oauth
(:require [cheshire.core :refer [parse-string generate-string]]
[mount.core :refer [defstate]]
[buddy.core.keys :as keys]
[buddy.core.dsa :as dsa]
[backend.config :refer [env]]
[org.httpkit.client :as http])
(:import org.apache.commons.codec.binary.Base64))
(def access_token (atom nil))
(defstate private-key :start (-> env
@clonekim
clonekim / Application.kt
Last active March 31, 2023 03:52
Ktor+koin
import com.fasterxml.jackson.databind.SerializationFeature
import com.google.api.services.docs.v1.Docs
import com.google.api.services.drive.Drive
import io.ktor.application.Application
import io.ktor.application.call
import io.ktor.application.install
import io.ktor.features.*
import io.ktor.http.ContentType
import io.ktor.http.HttpStatusCode
import io.ktor.http.content.resources
@clonekim
clonekim / multipart_upload.go
Created June 8, 2020 23:53 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"