Skip to content

Instantly share code, notes, and snippets.

View lucidfrontier45's full-sized avatar

杜世橋 Du Shiqiao lucidfrontier45

  • GROUND Inc.
  • Tochigi, Japan
View GitHub Profile
@lucidfrontier45
lucidfrontier45 / .clang-format
Last active May 2, 2022 15:54
VSCode settings for Python/C++ development with clangd LSP
BasedOnStyle: Webkit
AlignOperands: true
AlignAfterOpenBracket: Align
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
ConstructorInitializerAllOnOneLineOrOnePerLine: false
BreakConstructorInitializers: BeforeColon
AlwaysBreakTemplateDeclarations: true
ColumnLimit: 88
@lucidfrontier45
lucidfrontier45 / test.cpp
Last active September 25, 2021 20:51
Test Copy and Move constructor
#include <iostream>
struct MyVector {
size_t current_size = 0;
size_t capacity = 0;
double* data = nullptr;
MyVector() : capacity { 10 }, current_size { 0 }
{
@lucidfrontier45
lucidfrontier45 / Makefile
Last active May 12, 2022 00:32
python linter and vscode settings
all: check
format:
black .
isort .
lint: format
flake8 --exit-zero .
mypy --show-column-numbers .
@lucidfrontier45
lucidfrontier45 / apiclient.py
Created April 22, 2020 00:39
APIClient wrapper
from urllib.parse import urljoin
import requests
def ensure_slash(s):
if not s.endswith("/"):
s = s + "/"
return s
@lucidfrontier45
lucidfrontier45 / settings.json
Created April 13, 2020 23:54
vscode-setting for python
{
"python.pythonPath": "venv/bin/python3.7",
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"[python]": {
"editor.formatOnPaste": false,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
@lucidfrontier45
lucidfrontier45 / smart_sort.py
Created February 27, 2020 10:54
smart_sort
from functools import total_ordering
def _apply(v, k):
if callable(k):
return k(v)
else:
return v[k]
@lucidfrontier45
lucidfrontier45 / KRR_GPR_test.ipynb
Last active February 24, 2020 03:37 — forked from Yukishita26/KRR_GPR_test.ipynb
Comparison of GPR and KRR
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lucidfrontier45
lucidfrontier45 / dunnet_test.r
Created January 6, 2020 10:58
Testing Dunnett's test
library(reshape2)
library(multcomp)
n <- 10
ctrl <- rnorm(n, 0, 0.5)
a <- rnorm(n, 0.1, 0.5)
b <- rnorm(n, 2, 0.5)
df <- melt(data.frame(ctrl = ctrl, a = a, b=b))
names(df) <- c("cat", "val")
@lucidfrontier45
lucidfrontier45 / model.stan
Created December 3, 2019 14:23
Stan Coin flipping Test
data {
int<lower=0> N;
}
transformed data {
int<lower=0> n;
n = N / 2;
}
parameters {
@lucidfrontier45
lucidfrontier45 / fp.c
Created October 17, 2019 13:55
Functional programming in C
#include <stdio.h>
double sum(const double *x, double s, size_t n)
{
if (n == 0)
{
return s;
}
return sum(x + 1, s + *x, n - 1);