This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """ | |
| A quick sync script for symbols from NFS->S3 | |
| We can't simply record the time our sync script ran and find all newer files | |
| since files with timestamps in the past may appear. So, keep track of all .txt | |
| index files that we encounter, and only sync files when there are additions | |
| to that set. | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Check isDir in golang | |
| // use a switch to make it a bit cleaner | |
| fi, err := file.Stat(); | |
| switch { | |
| case err != nil: | |
| // handle the error and return | |
| case fi.IsDir(): | |
| // it's a directory | |
| default: | |
| // it's not a directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Decrease TIME_WAIT seconds | |
| net.ipv4.tcp_fin_timeout = 30 | |
| # Recycle and Reuse TIME_WAIT sockets faster | |
| net.ipv4.tcp_tw_recycle = 1 | |
| net.ipv4.tcp_tw_reuse = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Report time to first byte for the provided URL using a cache buster to ensure | |
| # that we're measuring full cold-cache performance | |
| while (($#)); do | |
| echo $1 | |
| curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" \ | |
| -w "%{http_code}\tPre-Transfer: %{time_pretransfer}\tStart Transfer: %{time_starttransfer}\tTotal: %{time_total}\tSize: %{size_download}\n" \ | |
| "$1?`date +%s`" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Project Title</title> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| <meta name="viewport" content="width=device-width"> | |
| <meta name="description" content=""> | |
| <link rel="shortcut icon" href="favicon.ico"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 一只站在树上的鸟儿,从来不会害怕树枝断裂,因为她相信的不是树枝,而是她自己的翅膀 | |
| 马行无力皆因瘦、人不风流只为贫 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function parse_git_branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /' | |
| } | |
| function git_unadded_new { | |
| if git rev-parse --is-inside-work-tree &> /dev/null | |
| then | |
| if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] | |
| then | |
| echo "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var oldSync = Backbone.sync; | |
| Backbone.sync = function(method, model, options){ | |
| options.beforeSend = function(xhr){ | |
| xhr.setRequestHeader('X-CSRFToken', CSRF_TOKEN); | |
| }; | |
| return oldSync(method, model, options); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Template backbone.js code that encapsulates a | |
| * datatable.net table within a view for a hypothetical ;) | |
| * auction listings application. | |
| */ | |
| var HomeRouter = Backbone.Router.extend({ | |
| routes: { | |
| 'refresh' : 'refresh', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| '''将搜狗拼音导出的文本词库转换成ibus-libpinyin的用户词典 | |
| by Conanca | |
| ''' | |
| content = open("搜狗词库导出_2014_1_6.txt").read().decode('utf16').encode('utf8') | |
| lines = content.split('\n') | |
| f=open('ibus.txt','w') |