Skip to content

Instantly share code, notes, and snippets.

View peacock0803sz's full-sized avatar
🍻
Chreees!!

Peacock peacock0803sz

🍻
Chreees!!
View GitHub Profile
@peacock0803sz
peacock0803sz / expand_jinja2.py
Created August 9, 2023 15:46
Expand Jinja2 Template with CSV/TSV/JSON
#!/usr/bin/env python3.11
import argparse
from collections.abc import Iterable
from dataclasses import asdict, dataclass
from enum import Enum
from pathlib import Path
from typing import Literal, NamedTuple
from jinja2 import Environment, FileSystemLoader
@peacock0803sz
peacock0803sz / csv2issue.ts
Last active February 6, 2023 09:57
Create GitHub issues from a CSV file
#!/usr/bin/env -S deno run --allow-env --allow-read --allow-run --allow-net --allow-write
// Description: Create GitHub issues from a CSV file
// Usage: ./csv2issue.ts <csv file> [--dry-run|-d|-dry]
// CSV format: title, projects(optional), labels(optional), assignee(optional)
import * as flags from "https://deno.land/[email protected]/flags/mod.ts";
import { parse as parseCSV } from "https://deno.land/[email protected]/encoding/csv.ts";
import * as path from "https://deno.land/[email protected]/path/mod.ts";
@peacock0803sz
peacock0803sz / tiny-http.rs
Created July 21, 2022 16:57
Tiny HTTP Server in Rust
use std::io::prelude::*;
use std::net::{TcpListener, TcpStream};
use std::thread;
const RESPONSE: &[u8] = "HTTP/1.1 200 OK\r\nContent-Type: text/html; charset=utf-8\r\n\r\n\
<!DOCTYPE html><html><head><title>Welcome to tiny-http!</title></head>\
<body><h1>Welcome to tiny-http!</h1></body></html>"
.as_bytes();
fn handle_client(mut stream: TcpStream) {
@peacock0803sz
peacock0803sz / dogpile_minimal.py
Last active December 17, 2021 09:24
A minimal example for dogpile.cache in pyramid
import logging
import random
from dogpile.cache import make_region
from pyramid.config import Configurator
logger = logging.getLogger(__name__)
region = make_region()
@peacock0803sz
peacock0803sz / gsnet_ssh_scanner.py
Created September 12, 2021 05:22
gsnet_ssh_scanner.py
from collections.abc import Iterable
import csv
from io import StringIO
import urllib.request
import socket
import subprocess
REGISTERD_PORTS = (22,) + tuple(range(1024, 49151))
HOSTS_CSV = "https://scrapbox.io/api/table/Geek-SpaceBox/GSNet%E3%81%AE%E3%83%9B%E3%82%B9%E3%83%88%E4%B8%80%E8%A6%A7/hosts.csv"
@peacock0803sz
peacock0803sz / ja.md
Last active July 22, 2021 07:47 — forked from terapyon/pyhack-camp-manual.md
pyhack合宿マニュアル

概要

  • 年に2回実施している、pyhack合宿の説明文書
  • 貸し切りで開催を前提にしている

施設・設備

インターネット回線

  • 宿にはBフレッツ光回線
from random import choice
from typing import Generator
ZUN = "ズン"
DOKO = "ドコ"
KIYOSHI = "キ・ヨ・シ!"
def generate_stream() -> Generator[str, None, None]:
while True:
@peacock0803sz
peacock0803sz / map-gen-settings.json
Created March 21, 2020 18:04
config "rail world"
{
}
@peacock0803sz
peacock0803sz / docker-compose.yml
Last active March 21, 2020 18:12
factorio on docker
version: "3"
services:
factorio:
image: factoriotools/factorio:1.8
ports:
- "34197:34197/udp"
- "27015:27015/tcp"
volumes:
- "data:/factorio"
environment:
@peacock0803sz
peacock0803sz / django-toolbelt
Last active July 27, 2019 18:03
django-logs
Installing initially failed dependencies…
[pipenv.exceptions.InstallError]: File "/home/peacock/.anyenv/envs/pyenv/versions/3.7.4/lib/python3.7/site-packages/pipenv/core.py", line 2611, in do_sync
[pipenv.exceptions.InstallError]: system=system,
[pipenv.exceptions.InstallError]: File "/home/peacock/.anyenv/envs/pyenv/versions/3.7.4/lib/python3.7/site-packages/pipenv/core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]: File "/home/peacock/.anyenv/envs/pyenv/versions/3.7.4/lib/python3.7/site-packages/pipenv/core.py", line 859, in do_install_dependencies
[pipenv.exceptions.InstallError]: retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[pipenv.exceptions.InstallError]: File "/home/peacock/.anyenv/envs/pyenv/versions/3.7.4/lib/python3.7/site-packages/pipenv/core.py", line 763, in batch_install
[pipenv.exceptions.InstallError]: _cleanup_procs(procs, not blocking, failed_deps_queue, retry=