Skip to content

Instantly share code, notes, and snippets.

View binderclip's full-sized avatar
👨‍💻
build

clip binderclip

👨‍💻
build
  • Beijing
View GitHub Profile
{"sig":"bd7b55e69abed7c9417010c4e168c0f6e33041d35d794f3a751783fabbc691e1d6aa269043f75a117f1605c49edb0bef900799bb0d86f200b95a7f252ceb5dc51","msghash":"ecbc123deb91ef0e92accc34fa95450c2adbaacffcc9288eca03b1fe65f3065c"}
@binderclip
binderclip / .pre-commit-config.yaml
Created February 7, 2018 02:29
pre-commit-config sample
# See http://pre-commit.com for more information
# See http://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
sha: v1.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: autopep8-wrapper
args:
@binderclip
binderclip / demo.json
Last active July 22, 2018 04:40
json and yaml syntax
{
"d_str": "hello",
"d_str2": "hello hello /.':",
"d_empty_str": "",
"d_int": 123,
"d_float": 123.456,
"d_null": null,
"d_array_of_str": ["a", "b"],
"d_empty_array": [],
"d_array_of_array": [["aa", "ab"], ["ba", "bb"]],
@binderclip
binderclip / ntp.conf
Created December 7, 2017 14:56
ntp.conf from aliyun ecs
# ntp.conf
driftfile /var/lib/ntp/drift
pidfile /var/run/ntpd.pid
logfile /var/log/ntp.log
# Access Control Support
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
@binderclip
binderclip / gist:b3f48514d759c710d2f3bc07fdbd0cb2
Created August 28, 2017 12:19 — forked from aqualungdesign/gist:4612802
Changing the photoshop cs6 language. MAC OS
#go to folder:
/Applications/Adobe Photoshop CS6/Locales/pt_BR/Support Files/tw10428.dat
#rename the file tw10428.dat for tw10428.bak
@binderclip
binderclip / config_per_commit_exclude.md
Created March 15, 2017 09:39
如何设置 pre_commit 的 exclude

如何设置 pre_commit 的 exclude

首先 exclude 只能作用于 hook,所以需要在 hook 的位置去配置,而不能作用于全局的 repo,可以从下面看到:

https://github.com/pre-commit/pre-commit/blob/master/pre_commit/clientlib.py#L51

另外实验一下会发现在 repo 上配置 exclude 不会被读取(比如故意填写成 array 也不会报错)。而在 hook 上类型填错的话会报错。

另外在 run_hook 的函数中也看到了是从 hook 的配置中读取的配置。

@binderclip
binderclip / emoji.plist
Created December 14, 2016 14:05 — forked from xhacker/emoji.plist
/System/Library/LinguisticData/RequiredAssets_zh.bundle/AssetData/emoji.plist in OS X 10.11 Copyright (C) Apple Inc.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>0</key>
<dict>
<key>emoji</key>
<array>
<string>0⃣️</string>
</array>
# coding:utf-8
import csv
def add_bom():
filename = 'pool1xcf电器池1_.csv'
with open('{filename}'.format(filename=filename), 'r+b') as file:
file.write('\xef\xbb\xbf')
@binderclip
binderclip / flask_file_upload.py
Created July 18, 2016 08:57
Flask file upload
import os
from flask import Flask, request, redirect, url_for, send_from_directory
from werkzeug.utils import secure_filename
UPLOAD_FOLDER = '/tmp/flask-upload-test/'
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER