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
#!/usr/bin/env python3 | |
phrases = ''' | |
; 希腊字母: 参考 https://en.wikipedia.org/wiki/Greek_alphabet | |
Alpha,1=Α | |
alpha,1=α | |
Nu,9=Ν | |
nu,9=ν | |
Beta,1=Β |
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
#!/usr/bin/env -S bash -c 'docker build -t devbox --build-arg USER_ID=$(id -u) --build-arg USER_NAME=$(id -un) --build-arg GROUP_ID=$(id -g) --build-arg GROUP_NAME=$(id -gn) $(realpath $(dirname $0))' | |
FROM ubuntu:20.04 | |
ARG USER_ID | |
ARG USER_NAME | |
ARG GROUP_ID | |
ARG GROUP_NAME | |
RUN addgroup --gid $GROUP_ID $GROUP_NAME; exit 0 |
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
#!/usr/bin/env nix-shell | |
#! nix-shell -p "haskellPackages.ghcWithPackages (p: with p; [conduit conduit-extra bytestring text hint])" | |
#! nix-shell -i "ghci -ignore-dot-ghci -fdefer-type-errors -XTypeApplications" | |
{-# language ScopedTypeVariables, TypeApplications, PartialTypeSignatures #-} | |
{-# language OverloadedStrings #-} | |
import Conduit | |
import Data.Conduit | |
import Data.ByteString (ByteString) |
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
#!/usr/bin/env bash | |
#So that directories are relative to current file path instead of cwd | |
#Ref: https://stackoverflow.com/questions/242538/unix-shell-script-find-out-which-directory-the-script-file-resides | |
cd $(dirname $0) | |
cd ./server | |
#Start multiple daemon processes and kill them all in one shot | |
#Ref: https://stackoverflow.com/questions/3004811/how-do-you-run-multiple-programs-in-parallel-from-a-bash-script | |
(trap 'kill 0' SIGINT EXIT; |
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
#!/usr/bin/env python3 | |
import sys | |
import os | |
relpath = lambda p: os.path.normpath(os.path.join(os.path.dirname(__file__), p)) | |
sys.path.append(relpath('..')) # so that you can import from upper dir | |
path1 = relpath('../src/main.py') | |
print(f'path1 relative to cwd: {path1}') | |
print(f'path1 absolute path: ({ os.path.abspath(path1) })') |
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
{-# language TemplateHaskell #-} | |
{-# language TypeFamilies #-} | |
{-# language StandaloneDeriving, DeriveFunctor, DeriveFoldable, DeriveTraversable, DeriveGeneric, DeriveDataTypeable, DeriveAnyClass, FlexibleContexts #-} | |
import Control.Monad.Free | |
import Data.Functor.Foldable | |
import Data.Functor.Foldable.TH | |
import Data.Functor.Classes | |
import Text.Show.Deriving | |
import Data.Foldable |
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
/* | |
Assuming: | |
1. l <= r | |
2. forall u, v, u < v -> f(u) <= f(v) | |
So, curve of f should looks like | |
______ | |
f: ___| | |
So we know: |
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
package tools; | |
import com.google.gson.*; | |
import com.google.gson.reflect.TypeToken; | |
import com.google.gson.stream.JsonReader; | |
import com.google.gson.stream.JsonToken; | |
import com.google.gson.stream.JsonWriter; | |
import io.vavr.collection.List; | |
import io.vavr.control.Option; | |
import java.io.IOException; |
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
899 execve("/usr/bin/xeyes", ["xeyes"], 0x7ffc75d322e8 /* 29 vars */) = 0 | |
899 brk(NULL) = 0x5630ea012000 | |
899 arch_prctl(0x3001 /* ARCH_??? */, 0x7ffd2662e3f0) = -1 EINVAL (Invalid argument) | |
899 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) | |
899 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 | |
899 fstat(3, {st_mode=S_IFREG|0644, st_size=53133, ...}) = 0 | |
899 mmap(NULL, 53133, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8626f6c000 | |
899 close(3) = 0 | |
899 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXext.so.6", O_RDONLY|O_CLOEXEC) = 3 | |
899 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340E\0\0\0\0\0\0"..., 832) = 832 |
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
package my.demo.project.test; | |
import com.google.gson.JsonElement; | |
import com.google.gson.JsonParser; | |
import com.google.gson.reflect.TypeToken; | |
import io.vavr.control.Option; | |
import org.junit.Test; | |
import my.demo.project.tools.JsonHelper; | |
public class JsonTest { |