Skip to content

Instantly share code, notes, and snippets.

@Nishikoh
Nishikoh / sh
Created January 12, 2025 14:05
pants + fzf
pants --level=error list | fzf
@Nishikoh
Nishikoh / Dockerfile
Created August 21, 2024 18:58
uv with docker
FROM python:3.11-slim
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
ENV UV_SYSTEM_PYTHON=1
WORKDIR /app
RUN uv venv /opt/venv && \
touch README.md
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="/opt/venv/bin:$PATH"
@Nishikoh
Nishikoh / gh_search_org_in_japan.graphql
Created July 13, 2024 13:57
[GrphaQL] search organization in japan
{
search(
query: "location:Japan type:organization language:rust language:python"
type: USER
first: 30
) {
edges {
node {
... on Organization {
name
@Nishikoh
Nishikoh / on_pants.py
Last active June 22, 2024 21:55
A python program to determine if the program is running on pants.
import os
def on_pants() -> bool:
# .pants.bootrap
return os.getenv("ON_PANTS") == "true"
def on_pants_test() -> bool:
# pants.toml [test] section
return os.getenv("ON_TEST") == "true"
@Nishikoh
Nishikoh / poetry_update_bulk.sh
Created May 28, 2024 14:37
poetry update bulk
DIR=$(
cd $(dirname $0)
pwd
)
echo $DIR
dirs=$(rg --files-with-matches tool.poetry | xargs -I{} dirname {})
for dir in $dirs; do
echo $dir
@Nishikoh
Nishikoh / suggest commit message
Created May 28, 2024 14:32
sugest commit message
gh copilot suggest "I want to commit changes. Please read current change and suggest the message with changed file and changed motivation: $(git diff --staged)"
[GLOBAL]
print_stacktrace = true
remote_cache_read = true
remote_cache_write = true
remote_store_address = "grpc://localhost:9092"
remote_instance_name = "main"
colors = true
backend_packages.add = [
"pants.backend.shell.lint.shfmt",
"pants.backend.shell.lint.shellcheck",
@Nishikoh
Nishikoh / set_value_nested_dict.py
Created March 7, 2022 12:12
Set a value for the nested dict
from collections import defaultdict
def set_value_nested_dict(keys, value):
dct = defaultdict(dict)
if len(keys) == 1:
return {keys[0]: value}
dct[keys[0]] |= set_value_nested_dict(keys[1:], value)
return dict(dct)
"""example
biosで起動優先順位を変更して、fastbootみたいなのを無効にする
https://curio-shiki.com/blog/support/clone-hdd-ssd-fixed
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define INF (1e9)
int n;
string t;
void solve( ) {