Skip to content

Instantly share code, notes, and snippets.

View slow-is-fast's full-sized avatar

slow-is-fast slow-is-fast

View GitHub Profile
```shell
for i in $( seq 1 90 ); do
git commit -m `printf add ch$i` `printf ch$i.md`
gp
done
```
@slow-is-fast
slow-is-fast / create_multiple_file.md
Created January 7, 2018 08:48
Create multiple file
for i in $( seq 1 90 ); do 
  touch `printf  "ch%02d.md" "$i"`;
done
@slow-is-fast
slow-is-fast / gsed.md
Last active January 7, 2018 03:07
insert blank line after each line to format markdown file
gsed -i -e 'G;' ch02.md

gsed means gun sed on Mac.

@slow-is-fast
slow-is-fast / redis_key_sizes.sh
Last active December 20, 2017 02:46 — forked from epicserve/redis_key_sizes.sh
A simple script to print the size of all your Redis keys. #redis
#!/usr/bin/env bash
# This script prints out all of your Redis keys and their size in a human readable format
# Copyright 2013 Brent O'Connor
# License: http://www.apache.org/licenses/LICENSE-2.0
human_size() {
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } '
}
  • install predis/predis

  • use Illuminate\Support\Facades\Redis; don't use Redis directly.

@slow-is-fast
slow-is-fast / pg-running-queries.sql
Created November 22, 2017 08:40 — forked from JoshuaGross/pg-running-queries.sql
List running queries in PostGres
select * from pg_stat_activity;
@slow-is-fast
slow-is-fast / spacemacs_max_window.md
Created November 5, 2017 07:01
spacemacs max window on startup

dotspacemacs-maximized-at-startup t

在 .spacemacs 中修改变量 dotspacemacs-maximized-at-startup 为 t 默认 nil

@slow-is-fast
slow-is-fast / shell_tips.md
Last active November 4, 2017 15:09
编写shell 脚本时要注意的事项
  • 开头加上 set -x set -e

#!/bin/bash set -e set -x

  • 使用工具检查脚本 shellcheck
@slow-is-fast
slow-is-fast / install_php_composer
Last active October 23, 2017 09:43
install_php_composer.md
```shell
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"
```
@slow-is-fast
slow-is-fast / onepiece
Created October 14, 2017 07:12
从磁力搜吧抓取海贼王的磁力链接
#!/usr/bin/env python
#-*- encoding:utf8 -*-
"""
从磁力搜吧抓取海贼王的磁力链接
"""
import sys
try:
import requests