Skip to content

Instantly share code, notes, and snippets.

View ytnobody's full-sized avatar
♨️
Loves Sento

Satoshi Azuma a.k.a. ytnobody ytnobody

♨️
Loves Sento
View GitHub Profile
@ytnobody
ytnobody / ecto-select-count-groupby.exs
Created December 2, 2019 06:12
[Ecto] SELECT bookshelf.id AS bookshelf_id, COUNT(book.id) AS books_count FROM bookshelf JOIN book ON bookshelf.id = book.bookshelf_id GROUP BY bookshelf.id
from(bookshelf in Bookshelf,
join: book in Book, on bookshelf.id == book.bookshelf_id,
group_by: bookshelf.id,
select: %{bookshelf_id: bookshelf.id, books_count: count(book.id)}
) |> Repo.all()
@ytnobody
ytnobody / example.go
Last active May 26, 2020 15:39
こういうことをやりたい
package main
import (
"database/sql"
_ "github.com/go-sql-driver/mysql"
"github.com/ytnobody/gomysqlerror"
"github.com/volatiletech/sqlboiler/boil"
)
@ytnobody
ytnobody / README.md
Created August 29, 2022 00:40
a rough script that helps to block rogue like client to your postfix server

postfix-scanner-block.sh

a rough script that helps to block rogue like client to your postfix server

usage

Anyway you should chmod +x and check behavior first.

# chmod +x ./postfix-scanner-block.sh
@ytnobody
ytnobody / devcontainer.json
Created December 7, 2024 02:26
nodejs + prisma devcontainer
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Debian",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
"features": {
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/swift-server-community/swift-devcontainer-features/sqlite:1": {}
},