Skip to content

Instantly share code, notes, and snippets.

View dahlia's full-sized avatar

Hong Minhee (洪 民憙) dahlia

View GitHub Profile
@dahlia
dahlia / README.md
Last active July 30, 2018 14:02
니름 스프린트 사전 준비
@dahlia
dahlia / Dockerfile
Last active March 13, 2021 08:10
Running X11 GUI apps through Docker + XQuartz on macOS
FROM ubuntu:17.10
# We don't optimize the size of fslayer here...
RUN apt-get update
RUN apt-get install -y \
software-properties-common \
ttf-ubuntu-font-family \
fonts-ubuntu-title \
fonts-ubuntu-font-family-console
RUN add-apt-repository -y \
@dahlia
dahlia / query_debug.py
Last active May 4, 2018 18:12
Print SQLAlchemy queries (including bind params).
"""Print SQLAlchemy queries (including bind params).
See also: http://docs.sqlalchemy.org/en/latest/faq/sqlexpressions.html#faq-sql-expression-string
"""
def show_query(query):
qc = query.statement.compile(
dialect=query.session.bind.dialect,
@dahlia
dahlia / FizzBuzz.hs
Last active January 14, 2018 07:00
FizzBuzz: algebraic data types help you represent disjoint events as disjoint sets.
#!/usr/bin/env runhaskell
module FizzBuzz where
import Control.Monad
data FizzBuzz = Otherwise Int | Fizz | Buzz | FizzBuzz deriving (Show)
fizzBuzz :: Int -> FizzBuzz
fizzBuzz i = case (i `mod` 3 == 0, i `mod` 5 == 0) of
(False, False) -> Otherwise i
@dahlia
dahlia / ledger.sql
Last active April 3, 2018 10:49
Experiments on integrity of ledgers using constraints
BEGIN;
CREATE TABLE transaction (
id uuid PRIMARY KEY,
time timestamptz NOT NULL DEFAULT (now()),
ledger_id uuid NOT NULL,
prev_id uuid,
prev_time timestamptz,
prev_balance decimal NOT NULL,
genesis bool, -- It cannot be false, but only true or NULL.
@dahlia
dahlia / encykorea.aks.ac.kr.xml
Last active September 29, 2018 21:40
한국민족문화대백과사전 OpenSearch
<?xml version="1.0" encoding="utf-8"?>
<!-- How to install on Firefox:
window.external.AddSearchProvider(
"https://gist.github.com/dahlia/c4b8e88c60c8b273f7ede092b2c1c86b/raw/encykorea.aks.ac.kr.xml"
);
-->
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>한국민족문화대백과사전</ShortName>
<Description>한국민족문화대백과사전 검색</Description>
<InputEncoding>UTF-8</InputEncoding>
@dahlia
dahlia / encrypt.py
Last active October 17, 2018 10:08
ECIES + secp256k1, using coincurve (secp256k1 ECDH) and cryptography (AES-GCM)
import os
from coincurve import PrivateKey, PublicKey # type: ignore
from cryptography.hazmat.primitives.ciphers.aead import AESGCM # type: ignore
__all__ = 'decrypt', 'encrypt'
def encrypt(public_key: PublicKey, message: bytes) -> bytes:
disposable_priv_key: PrivateKey = PrivateKey()
@dahlia
dahlia / secp256k1.rb
Last active October 24, 2018 07:48 — forked from shazow/secp256k1.rb
Homebrew recipe for secp256k; originated from https://gist.github.com/shazow/c71c652409015479a7e6, but added some more build options; run to install: brew install --with-module-recovery --with-module-ecdh --without-benchmark https://gist.github.com/dahlia/439e1a7e5a770556a12b25aea797eda7/raw/secp256k1.rb
class Secp256k1 < Formula
desc "Optimized C library for EC operations on curve secp256k1"
homepage "https://github.com/bitcoin/secp256k1"
url "https://github.com/bitcoin/secp256k1.git"
option "with-module-recovery", "enable ECDSA pubkey recovery module"
option "with-module-ecdh",
"enable ECDH shared secret computation (experimental)"
option "without-benchmark", "do not compile benchmark"

Bencodex: Bencoding Extended

See instead.

@dahlia
dahlia / vscode.md
Last active January 14, 2022 09:10
Libplanet 개발 환경 설정

Libplanet 개발 환경 설정 (VS Code)

[Libplanet]은 널리 쓰이는 게임 엔진인 Unity를 염두에 두어, C#으로 작성되었습니다. 따라서 C# 개발 환경이 필요합니다. 다행히 .NET은 요 몇 년 사이 여러 플랫폼에서 두루 개발할 수 있는 여건이 마련되었습니다. 이 문서는 Linux, macOS, Windows 모두에서 Libplanet 개발을 하는 데에 필요한 환경을 설정하고 빌드하는 방법을 설명합니다.

따라하면서 잘 안되는 게 있으시면 [저희 Discord 서버][1]에 있는