Esempio n. 1
0
type twmeta struct {
	RefreshUrl string `json:"refresh_url"`
}
type twitresp struct {
	Statuses []twstatus
	Meta     twmeta `json:"search_metadata"`
}

const twSearchBase = "https://api.twitter.com/1.1/search/tweets.json"

var resnum = flag.IntP("number", "n", 20, "number of items to return")
var reverse = flag.BoolP("reverse", "r", false, "reverse order")
var retweets = flag.BoolP("retweets", "R", false, "include retweeets")
var follow = flag.BoolP("follow", "f", false, "follow mode")
var followDelay = flag.DurationP("followdelay", "F", time.Minute, "refresh delay in follow mode")

var fixes = strings.NewReplacer(
	"\n", ` \n `, // spaces to make c&p easier
	"‘", `'`,
	"’", `'`,
	"“", `"`,
	"”", `"`,
	"—", "-",
	"&", "&",
	"&lt;", "<",
	"&gt;", ">",
	"&quot;", `"`,
	"&apos;", "'",
)
Esempio n. 2
0
package main

import (
	"fmt"
	flag "github.com/ogier/pflag"
	"os"
	"strings"
	"syscall"
	"time"
)

var verbose = flag.BoolP("verbose", "v", false, "verbose")
var timeout = flag.DurationP("timeout", "T", 5*time.Second, "timeout (ex: 100ms or 3s)")
var printpath = flag.BoolP("path", "p", true, "show path")
var printdev = flag.BoolP("dev", "d", false, "show device")
var quiet = flag.BoolP("quiet", "q", false, "quiet mode, only set exit status")
var checktype = flag.StringP("type", "t", "nfs", "filesystem type to check")
var checkall = flag.BoolP("all", "a", false, "check all filesystems types")

type fs_t struct {
	path     string
	dev      string
	resptime time.Duration
	done     bool
	err      error
}

type fsmap_t map[string]fs_t

func (fs fs_t) String() (s string) {
	switch {
Esempio n. 3
0
	"runtime"
	"time"
)

const (
	version string = "0.0.1"
)

var (
	downloaded []int64
	boards     string = "a|b|c|d|e|f|g|gif|h|hr|k|m|o|p|r|s|t|u|v|vg|w|wg|i|ic|r9k|cm|hm|y|3|adv|an|cgl|ck|co|diy|fa|fit|hc|int|jp|lit|mlp|mu|n|po|pol|sci|soc|sp|tg|toy|trv|tv|vp|wsg|x|q"

	// Options
	minWidth     *int64         = flag.Int64P("min-width", "w", 0, "Minimum width of images")
	minHeight    *int64         = flag.Int64P("min-height", "h", 0, "Minimum height of images")
	refresh      *time.Duration = flag.DurationP("refresh", "r", time.Second*30, "Refresh rate (min 30s)")
	orignalNames *bool          = flag.BoolP("original-names", "o", false, "Save images under original filenames")
	showVersion  *bool          = flag.BoolP("version", "v", false, "Show version")
)

type Post struct {
	No             int64
	Resto          int64
	Sticky         bool
	Closed         bool
	Now            string
	Time           int64
	Name           string
	Trip           string
	Id             string
	Capcode        string
Esempio n. 4
0
	"github.com/ncw/rclone/fs"
	// Active file systems
	_ "github.com/ncw/rclone/drive"
	_ "github.com/ncw/rclone/dropbox"
	_ "github.com/ncw/rclone/googlecloudstorage"
	_ "github.com/ncw/rclone/local"
	_ "github.com/ncw/rclone/s3"
	_ "github.com/ncw/rclone/swift"
)

// Globals
var (
	// Flags
	cpuprofile    = pflag.StringP("cpuprofile", "", "", "Write cpu profile to file")
	statsInterval = pflag.DurationP("stats", "", time.Minute*1, "Interval to print stats (0 to disable)")
	version       = pflag.BoolP("version", "V", false, "Print the version number")
	logFile       = pflag.StringP("log-file", "", "", "Log everything to this file")
)

type Command struct {
	Name     string
	Help     string
	ArgsHelp string
	Run      func(fdst, fsrc fs.Fs)
	MinArgs  int
	MaxArgs  int
	NoStats  bool
}

// checkArgs checks there are enough arguments and prints a message if not
Esempio n. 5
0
	// Name of the HTTP form field when uploading a paste
	fieldName = "paste"
	// Content-Type when serving pastes
	contentType = "text/plain; charset=utf-8"
	// Report usage stats how often
	reportInterval = 1 * time.Minute

	// HTTP response strings
	invalidID     = "invalid paste id"
	unknownAction = "unsupported action"
)

var (
	siteURL   = pflag.StringP("url", "u", "http://localhost:8080", "URL of the site")
	listen    = pflag.StringP("listen", "l", ":8080", "Host and port to listen to")
	lifeTime  = pflag.DurationP("lifetime", "t", 24*time.Hour, "Lifetime of the pastes")
	timeout   = pflag.DurationP("timeout", "T", 5*time.Second, "Timeout of HTTP requests")
	maxNumber = pflag.IntP("max-number", "m", 0, "Maximum number of pastes to store at once")

	maxSize    = 1 * bytesize.MB
	maxStorage = 1 * bytesize.GB
)

func init() {
	pflag.VarP(&maxSize, "max-size", "s", "Maximum size of pastes")
	pflag.VarP(&maxStorage, "max-storage", "M", "Maximum storage size to use at once")
}

func getContentFromForm(r *http.Request) ([]byte, error) {
	if value := r.FormValue(fieldName); len(value) > 0 {
		return []byte(value), nil