This file contains 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 () { | |
if (!Worker) //Detect IE | |
document.location = "http://www.whatbrowser.org/ru/browser/"; | |
})(); |
This file contains 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
def indent(elem, level=0): | |
i = "\n" + level*" " | |
if len(elem): | |
if not elem.text or not elem.text.strip(): | |
elem.text = i + " " | |
if not elem.tail or not elem.tail.strip(): | |
elem.tail = i | |
for elem in elem: | |
indent(elem, level+1) | |
if not elem.tail or not elem.tail.strip(): |
This file contains 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 | |
NGINX_VERSION="1.4.7" | |
NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz" | |
PCRE_VERSION="8.34" | |
PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz" | |
OPENSSL_VERSION="1.0.1g" | |
OPENSSL_TARBALL="openssl-${OPENSSL_VERSION}.tar.gz" | |
OPENSSL_PATCH_URL="https://bugs.archlinux.org/task/35868?getfile=10648" | |
if [[ "${1}" == "clean" ]]; then |
This file contains 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 bash | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Ask for the administrator password upfront | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & |
This file contains 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
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse |
This file contains 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
package main | |
import ( | |
"io" | |
"os" | |
"fmt" | |
"crypto/rand" | |
"crypto/rsa" | |
"crypto/md5" | |
"crypto" |
This file contains 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 readLine(path string) { | |
inFile, _ := os.Open(path) | |
defer inFile.Close() | |
scanner := bufio.NewScanner(inFile) | |
scanner.Split(bufio.ScanLines) | |
for scanner.Scan() { | |
fmt.Println(scanner.Text()) | |
} | |
} |
This file contains 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
// equivalent to Python's `if not os.path.exists(filename)` | |
if _, err := os.Stat(filename); os.IsNotExist(err) { | |
fmt.Printf("no such file or directory: %s", filename) | |
return | |
} | |
In the above example we are not checking if err != nil because os.IsNotExist(nil) == false anyway. | |
To check if a file exists, |
This file contains 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
(defn tc [wndtime numwnds threshold & children] | |
(fixed-event-window wndtime | |
(combine folds/mean | |
(moving-event-window numwnds | |
(combine folds/minimum | |
(where (> metric threshold) | |
;;create a threshold crossing event | |
(with {:host nil :state "threshold crossed" :description (str "service crossed the value of " threshold " over " numwnds " windows of " wndtime " seconds")} | |
(apply sdo children))))))) | |
) |
This file contains 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
package main | |
import ( | |
"log" | |
"fmt" | |
"encoding/json" | |
) | |
var conf1 = ` | |
{ |
OlderNewer