Skip to content

Instantly share code, notes, and snippets.

@djun
djun / alchemical_model.py
Created August 26, 2018 15:33 — forked from harvimt/alchemical_model.py
SQLAlchemy to/from PyQt Adapters
#!/usr/bin/env python2
#-*- coding=utf-8 -*-
# © 2013 Mark Harviston, BSD License
from __future__ import absolute_import, unicode_literals, print_function
"""
Qt data models that bind to SQLAlchemy queries
"""
from PyQt4 import QtGui
from PyQt4.QtCore import QAbstractTableModel, QVariant, Qt
import logging # noqa
@djun
djun / CherryPy.wsgi
Created June 29, 2020 08:52 — forked from omedhabib/CherryPy.wsgi
CherryPy.wsgi
import socket
from cherrypy import wsgiserver
from app import application
server = wsgiserver.CherryPyWSGIServer(
bind_addr=('0.0.0.0', 9808),
wsgi_app=application,
request_queue_size=500,
server_name=socket.gethostname()
)
@djun
djun / common.sh
Created September 7, 2022 15:24 — forked from zhonger/common.sh
Just for myself
#!/bin/bash
Version=$(lsb_release -c --short)
Codename=$(lsb_release -r --short)
OSArch=$(uname -m)
User=$(whoami)
# 设置 sudo 免密码
echo "$(whoami) ALL=(ALL) NOPASSWD : ALL" | sudo tee /etc/sudoers.d/nopasswd4sudo
@djun
djun / docker-registry-mirrors.md
Created June 16, 2024 15:41 — forked from y0ngb1n/docker-registry-mirrors.md
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@djun
djun / OpenSourceBaas.md
Created August 1, 2024 11:54 — forked from PARC6502/OpenSourceBaas.md
List of open source, self hosted BaaS - Backend as a service

Backend as a Service

Supabase - ~52K stars

  • Designed explicitly as an open source firebase alternative
  • Typescript based
  • Docker support

Appwrite - ~32K stars

  • Written in JavaScript and PHP
  • Docker based
  • Realtime support across all services
@djun
djun / check_password.py
Created February 5, 2025 17:06 — forked from thuwarakeshm/check_password.py
Streamlit with Django
def check_password():
"""Returns `True` if the user had a correct password."""
def password_entered():
"""Checks whether a password entered by the user is correct."""
user = authenticate(
username=st.session_state['username'],
password=st.session_state['password']
)
@djun
djun / deepspeed-ddp.md
Created February 25, 2025 16:52 — forked from santurini/deepspeed-ddp.md
DeepSpeed Multi-node Training Setup

In this tutorial we assume to launch a distributed training on 2 nodes using DeepSpeed with the OpenMPI Launcher.

  1. First of all DeepSpeed needs a passwordless ssh connection with all the nodes, MASTER included:
# generate a public/private ssh key and make sure to NOT insert a passphrase

ssh-keygen -t rsa

# copy public key 'id_rsa' on the MASTER and SLAVE
@djun
djun / renderPdfByBase64.js
Created June 13, 2025 15:25 — forked from alex1504/renderPdfByBase64.js
Render all pages to html file by pdf.js
function renderPdfByBase64(base64Data) {
var currPage = 1; // 当前页面
var numPages = 0; // 总页数,由getDocument后获取
var thePDF = null;
var pdfData = base64ToUint8Array(base64Data);
PDFJS.getDocument(pdfData).then(function(pdf) {
thePDF = pdf;
numPages = pdf.numPages;
pdf.getPage(1).then(handlePages);
});

I'll help you build a 4x4 tic-tac-toe game in Python with a clean terminal interface. Let me create a comprehensive plan for this project.

Project Plan: 4x4 Tic-Tac-Toe Game

Core Components:

  1. Game Board Management

    • 4x4 grid representation using a 2D list
  • Clear board display with grid lines and position numbers