Skip to content

Instantly share code, notes, and snippets.

View L1aoXingyu's full-sized avatar
🎯
Agency: make great new things

Xingyu L1aoXingyu

🎯
Agency: make great new things
View GitHub Profile

Basic Coding Style Rules

Based on these core principles, we have carefully designed a set of basic rules that SWE Agents or vibe coding tools should follow:

  1. Minimize unnecessary indentation, spaces, and line breaks to keep the code compact.
  2. For top-level functions, classes, and module names, adhere to proper and complete naming conventions as much as possible. For code within functions, classes, or modules — especially temporary variables — reduce variable name length to minimize code size.
  3. Provide brief but necessary comments for top-level functions, classes, and modules to describe their purpose, inputs, and outputs. Inside functions, avoid comments unless absolutely necessary.
  4. Where possible, implement more functions, classes, or modules within a single file, especially when they are interrelated. Separate code into different files only when they serve distinct modules or functionalities.
  5. Use advanced language features and designs to reduce code size — for example, prefer lambda functio
@L1aoXingyu
L1aoXingyu / contemplative-llms.txt
Created January 9, 2025 03:30 — forked from Maharshi-Pandya/contemplative-llms.txt
"Contemplative reasoning" response style for LLMs like Claude and GPT-4o
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
@L1aoXingyu
L1aoXingyu / nsight.sh
Created January 10, 2024 02:30 — forked from mcarilli/nsight.sh
Favorite nsight systems profiling commands for Pytorch scripts
# This isn't supposed to run as a bash script, i named it with ".sh" for syntax highlighting.
# https://developer.nvidia.com/nsight-systems
# https://docs.nvidia.com/nsight-systems/profiling/index.html
# My preferred nsys (command line executable used to create profiles) commands
#
# In your script, write
# torch.cuda.nvtx.range_push("region name")
# ...
@L1aoXingyu
L1aoXingyu / git-ssh-error-fix.sh
Created October 14, 2022 09:39 — forked from Tamal/git-ssh-error-fix.sh
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone [email protected]:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T [email protected]
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
@L1aoXingyu
L1aoXingyu / client.py
Created September 24, 2020 08:46 — forked from edumucelli/client.py
Send and receive images using Flask, Numpy and OpenCV
import requests
import json
import cv2
addr = 'http://localhost:5000'
test_url = addr + '/api/test'
# prepare headers for http request
content_type = 'image/jpeg'
headers = {'content-type': content_type}
import torch
import torch.nn as nn
# Implementation of Deep Metric Learning by Online Soft Mining and Class-Aware Attention
# https://arxiv.org/pdf/1811.01459v2.pdf
class OSM_CAA_Loss(nn.Module):
def __init__(self, alpha=1.2, l=0.5, osm_sigma=0.8,use_gpu=True):
super(OSM_CAA_Loss, self).__init__()
self.use_gpu = use_gpu
from __future__ import print_function
from nvidia.dali.pipeline import Pipeline
import nvidia.dali.ops as ops
import nvidia.dali.types as types
from nvidia.dali.plugin.pytorch import DALIGenericIterator
import logging
import os
import numpy as np
@L1aoXingyu
L1aoXingyu / vimrc
Last active December 14, 2018 03:13
my .vimrc configuration
syntax enable
syntax on
set number
set cursorline
set tabstop=4
" 让配置变更立即生效
autocmd BufWritePost $MYVIMRC source $MYVIMRC
let mapleader=";"
@L1aoXingyu
L1aoXingyu / README-Template.md
Created November 30, 2018 01:44 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@L1aoXingyu
L1aoXingyu / tmux-cheatsheet.markdown
Created April 18, 2018 08:44 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]