I'm quite confused as there seems to be multiple redundant ways to solve my problem (read a file, parse the content, serve it via http). Most people on stackoverflow would use bufio, but I just can't get the differences between this package and the Buffer type of bytes and just reading a file with the os methods. Also I don't know when and why I should choose those ways to do it, when I have the simple, but non-versatile, ioutils.ReadFile.
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
$ ffcvt | |
Usage: | |
ffcvt [flags] | |
Flags: | |
-aes audio encoding method set (FFCVT_AES) | |
-ves video encoding method set (FFCVT_VES) | |
-aea audio encoding method append (FFCVT_AEA) |
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
<html> | |
<head> | |
<title></title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> | |
<script type="text/javascript" defer="defer"> | |
function cascadeSelect(parent, child){ | |
var childOptions = child.find('option:not(.static)'); | |
child.data('options',childOptions); | |
parent.change(function(){ |
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
# DevEnv:ubuntu | |
# Dockerfile for build environment for ubuntu | |
FROM sfxpt/ubuntu:zesty | |
# set the http_proxy to make use of cached packages from caching proxy server | |
#ENV http_proxy MY_HTTP_PROXY | |
# Set the env variables to non-interactive | |
ENV DEBIAN_FRONTEND noninteractive |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// strings.go | |
// Credit: http://www.cnblogs.com/golove/p/3236300.html | |
------------------------------------------------------------ | |
// Count 计算字符串 sep 在 s 中的非重叠个数 | |
// 如果 sep 为空字符串,则返回 s 中的字符(非字节)个数 + 1 | |
// 使用 Rabin-Karp 算法实现 | |
func Count(s, sep string) int |
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
func getReqAddons(r Request) string { | |
ret := "" | |
if len(r.RequestPlugins.RequestPlugin) != 0 { | |
for _, v := range r.RequestPlugins.RequestPlugin { | |
ret += fmt.Sprintf(" R: (%s) %s\n", v.Name, minify(v.RuleParameters.Xml)) | |
} | |
} | |
if len(r.ExtractionRules.ExtractionRule) != 0 { | |
for _, v := range r.ExtractionRules.ExtractionRule { | |
ret += fmt.Sprintf(" E: (%s: %s) %s\n", v.Name, v.VariableName, minify(v.RuleParameters.Xml)) |
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
func getReqAddons(r Request) string { | |
var buf bytes.Buffer | |
if len(r.RequestPlugins.RequestPlugin) != 0 { | |
for _, v := range r.RequestPlugins.RequestPlugin { | |
fmt.Fprintf(&buf, " R: (%s) %s\n", v.Name, | |
minify(v.RuleParameters.Xml)) | |
} | |
} | |
if len(r.ExtractionRules.ExtractionRule) != 0 { | |
for _, v := range r.ExtractionRules.ExtractionRule { |
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
//////////////////////////////////////////////////////////////////////////// | |
// Porgram: OdbcDemo | |
// Purpose: Go MSSQL odbc demo, using the code.google.com/p/odbc driver | |
// Authors: Tong Sun (c) 2013, All rights reserved | |
//////////////////////////////////////////////////////////////////////////// | |
// Style: gofmt -tabs=false -tabwidth=2 -w | |
package main |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.