Skip to content

Instantly share code, notes, and snippets.

View laixintao's full-sized avatar
📟
I live in the terminal.

laixintao

📟
I live in the terminal.
View GitHub Profile
@Jiezhi
Jiezhi / tmux.conf.bak
Last active April 11, 2022 02:07
tmux configure file from 《tmux:Productive Mouse-Free Development》
# Setting the prefix from C-b to C-a
set -g prefix C-a
# Free the original Ctrl-b prefix keybinding
unbind C-b
#setting the delay between prefix and command
set -sg escape-time 1
# Ensure that we can send Ctrl-A to other apps
@bmhatfield
bmhatfield / .profile
Last active March 18, 2024 07:43
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@lgyanf
lgyanf / add_query_parameters.py
Created June 14, 2016 10:49
A python decorator that adds query parameters to django-rest-framework swagger docstring.
# -*- coding: utf-8 -*-
import collections
import yaml
from rest_framework import fields
"""
Convert rest_framework.fields classes to Swagger data types according to http://swagger.io/specification/
Return 'string' by default.
@huangblue
huangblue / 从原仓库更新fork仓库
Created August 20, 2016 12:48
当原仓库更新后,如何更新自己fork别人的项目
git clone https://github.com/huangblue/codeparkshare 将fork的项目克隆到本地
git remote add codeparkshare https://github.com/Yixiaohan/codeparkshare 添加远程仓库(fork的原仓库)
git commit 提交本地变更
git remote update 更新原仓库
git checkout master 检出本地分支
@laixintao
laixintao / Git常用命令.sh
Last active August 20, 2022 06:52
一些常用的git命令 速查表
------------------------------commit------------------------------
$ git status # 检查文件当前的状态
$ git add [文件名] # 追踪新的文件
$ git diff --cached # 若要看已经暂存起来的文件和上次提交时的快照之间的差异
$ git commit -m "Story 182: Fix benchmark" # 用一行命令提交更新
$ git commit -a -m 'added new benchmarks' # 跳过add命令直接提交
$ git rm --cached log.log # 从git仓库中删除不小心追踪的文件(用于gitignore之前追踪的文件)
$ git mv file_from file_to # 移动文件/重命名文件
------------------------------branch------------------------------
@ewenchou
ewenchou / README.md
Last active July 8, 2023 04:36
Run Python script as systemd service
  1. Create a service file like dash_sniffer.service
  2. Put it in /lib/systemd/system/
  3. Reload systemd using command: systemctl daemon-reload
  4. Enable auto start using command: systemctl enable dash_sniffer.service
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@gyribeiro
gyribeiro / tmux_italic.md
Last active May 2, 2024 16:28
enable italic font on tmux
@numberoverzero
numberoverzero / run_scheduled.py
Last active February 16, 2020 07:58
00.async.periodic.rst
import asyncio
import functools
import json
import secrets
import aiohttp
from concurrent.futures import ALL_COMPLETED
@0x4D31
0x4D31 / beautiful_idiomatic_python.md
Last active April 19, 2024 09:17 — forked from JeffPaine/beautiful_idiomatic_python.md
[Beautiful Idiomatic Python] Transforming Code into Beautiful, Idiomatic Python #python

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]: