Skip to content

Instantly share code, notes, and snippets.

View bkbncn's full-sized avatar

Xiangyu Xu bkbncn

View GitHub Profile
@rain-1
rain-1 / LLM.md
Last active August 16, 2025 00:39
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@GadgetSteve
GadgetSteve / where_am_i.py
Last active June 27, 2022 06:42
Importable execution position in python
"""
Importable get called from file & location.
Based on a tweet by Ned Batchelder @nedbat
"""
import inspect
def where_am_i():
""" Return the current filename and line number. """
bf = inspect.currentframe().f_back
return (bf.f_globals.get("__file__", "interactive"), bf.f_lineno)

Python Automation Testing With Pytest

Pytest Framework Course

Pytest Usage

https://docs.pytest.org/

pytest [options] [file_or_dir] [file_or_dir] ...
import operator
people.sort(key=operator.itemgetter('age'))
people.sort(key=operator.itemgetter('name'))
# !/usr/bin/env python
# -*- coding: utf-8 -*-
__coverage__ = 0.00
__author__ = "Bruce_H_Cottman"
__license__ = "MIT License"
""" A sandbox DevOps implemented in Python.
Environment can vary by language, os, cpu, packages,
package versions....
"""
#
# Working through some examples from python 3 asyncio docs
#
# https://docs.python.org/3/library/asyncio.html#module-asyncio
#
import asyncio
import random
import time
@miguelgrinberg
miguelgrinberg / .tmux.conf
Last active March 15, 2022 11:39
My .tmux.conf file for working with tmux
# Set the prefix to ^A.
unbind C-b
set -g prefix ^A
bind a send-prefix
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
@miguelgrinberg
miguelgrinberg / .vimrc
Last active June 8, 2025 07:11
My .vimrc configuration for working in Python with vim
" plugins
let need_to_install_plugins = 0
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
let need_to_install_plugins = 1
endif
call plug#begin()
Plug 'tpope/vim-sensible'
@ben-doyle
ben-doyle / perforce.MD
Last active July 5, 2024 03:47
Perforce for git users.

Understanding Perforce (as a git user).

Commands

Git Perforce Command Line P4V Notes
git pull p4 sync get latest revision
n/a p4 update ? Get latest revision without overwriting files that have been changed.
git checkout p4 edit checkout You plan to change a file from the version control system
git commit p4 submit submit
git push n/a n/a No perforce equivalent. There is no concept of a pure local submit in Perforce.
@tomshaffner
tomshaffner / nx2gt.py
Created June 3, 2019 15:18 — forked from bbengfort/nx2gt.py
Convert a networkx to graph-tool graph
# -*- coding: utf-8 -*-
import networkx as nx
import graph_tool as gt
def get_prop_type(value, key=None):
"""
Performs typing and value conversion for the graph_tool PropertyMap class.
If a key is provided, it also ensures the key is in a format that can be
used with the PropertyMap. Returns a tuple, (type name, value, key)
"""