Skip to content

Instantly share code, notes, and snippets.

@imzhi
imzhi / .vimrc
Last active June 24, 2016 06:40
basic .vimrc
syntax on
filetype plugin on
set enc=utf8
set nocompatible
set nu
set et
set sw=4
set ts=4
set history=500
set showmatch
@imzhi
imzhi / backup_db.pyw
Last active July 27, 2016 01:51
备份数据库脚本
#!/usr/bin/env python3
# *-* coding: utf-8 *-*
# 脚本:备份数据库脚本
# 作者:yxz
# 时间:2016.06.13
import os
import time
from subprocess import call
@imzhi
imzhi / aliases.txt
Created June 29, 2016 13:05
Git common aliases
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.hist 'log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
git config --global alias.type 'cat-file -t'
git config --global alias.dump 'cat-file -p'
git config --global alias.ps 'push origin master'
git config --global alias.pl 'pull origin master'
@imzhi
imzhi / tmux-cheatsheet.markdown
Created August 18, 2016 08:17 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@imzhi
imzhi / .vimrc
Last active March 22, 2021 07:27
Advanced .vimrc (简单 vim 配置)
set nocompatible
syntax on
filetype off
filetype indent plugin on
set nocp
set history=1000
set nu
set sw=4
set sts=4
@imzhi
imzhi / git-branch-simplify.md
Created November 5, 2016 01:30
How to simplify the graph produced by git log --graph

Ideas for improvements to git log --graph

I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.

Make the graph for --topo-order less wiggly

Imagine a long-running development branch periodically merges from master. The git log --graph --all --topo-order is not as simple as it could be, as of git version 1.7.10.4.

It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.

@imzhi
imzhi / nginx.conf
Created January 10, 2017 16:00 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@imzhi
imzhi / .gitconfig
Last active October 31, 2023 07:25
git全局配置,~/.gitconfig,~/.gitignore_global
[core]
excludesfile = %(prefix)/Users/yxz/.gitignore_global
autocrlf = input
editor = vim
# 修复 git status 中文文件名显示为十六进制字符串问题
quotepath = false
[http]
sslVerify = false
postBuffer = 52400000
[alias]
@imzhi
imzhi / StatChannelData.php
Last active November 13, 2019 08:36
laravel artisan命令支持传入选项:日期参数。StatChannelData.php示例实现:--daterange直接传入日期范围字符串,也可以单独传入--date指定单独日期,并且只能二选一;StatFinanceApp.php示例实现:--start, --end 未传入时或者传入值非法时默认赋值为昨天
<?php
namespace App\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use App\Repositories\Admin\ChannelRepository;
class StatChannelData extends Command
{
@imzhi
imzhi / auto_laravel_pagination.php
Last active November 14, 2019 06:55
手动构造 laravel paginate 数据
<?php
$list_operation = AppListXianwanLog::where(function ($query) use ($args) {
$name = $args['name'] ?? '';
if ($name) {
$query->whereHas('appXianwan', function ($hasQuery) use ($name) {
$hasQuery->where('adname', 'like', "%{$name}%");
});
}
})