Skip to content

Instantly share code, notes, and snippets.

View sgqy's full-sized avatar

sgqy

  • Japan
  • 19:55 (UTC +09:00)
  • X @sgqy_
View GitHub Profile
#!/usr/bin/env python3
from captcha.image import ImageCaptcha
cap = ImageCaptcha(width=400, height=100, fonts=['/usr/share/fonts/opentype/source-code-pro/SourceCodePro-Regular.otf'])
img = cap.generate_image('13800138000')
img.show()
@sgqy
sgqy / valloc.c
Created September 26, 2021 14:06
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <sys/mman.h>
int main()
{
#if 0
const size_t addr = 0x00000100f0000000;
$('li.search_result_img_box_inner').each((i, e) => {
$(e).css('background', '')
$(e).css('opacity', '')
v = $(e).find('span.strike').text().replace(/[,円]/g, '')
p = Number(v)
cx = Math.min(Math.max(0, Math.floor(p / 500)), 16).toString(16)
$(e).css('background', `#f${cx}4`)
b = $(e).find('ul[data-is_bought=true]')
if (b.length > 0) {
$(e).css('opacity', '0')
@sgqy
sgqy / Dockerfile
Last active August 18, 2024 13:24
code-server with golang and cuda
FROM codercom/code-server:bookworm
# Use root to install tools
USER 0
# Install C++
RUN --mount=type=tmpfs,target=/dev/shm bash <<EOF
set -euxo pipefail
cd /dev/shm
@sgqy
sgqy / command.txt
Last active November 7, 2024 00:10
print 2 pages of book to one b5 paper
docker compose run --entrypoint bash tex
pdfjam --no-tidy --nup 2x1 --b4paper --landscape --frame true --trim '6.5mm 25mm 6.5mm 10mm' --outfile o.pdf nst.pdf '6-'