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
/* | |
http://tour.golang.org/flowcontrol/8 | |
Exercise: Loops and Functions | |
As a simple way to play with functions and loops, implement the square root function using Newton's method. | |
In this case, Newton's method is to approximate Sqrt(x) by picking a starting point z and then repeating: | |
z^2 - x | |
z = z - ------- | |
2z |
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 "code.google.com/p/go-tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
a := make([][]uint8, dy) | |
for y := 0; y < dy; y++ { | |
a[y] = make([]uint8, dx) | |
for x := 0; x < dx; x++ { | |
a[y][x] = uint8((x^y) * (x^y)) |
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 ( | |
"code.google.com/p/go-tour/wc" | |
"strings" | |
) | |
func WordCount(s string) map[string]int { | |
m := make(map[string]int) | |
words := strings.Fields(s) |
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 "fmt" | |
// fibonacci is a function that returns | |
// a function that returns an int. | |
func fibonacci() func() int { | |
seq := []int{0,1} | |
i := 0 | |
return func() int { |
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
21:49:52 T:1475405976 NOTICE: special://profile/ is mapped to: special://masterprofile/ | |
21:49:52 T:1475405976 NOTICE: ----------------------------------------------------------------------- | |
21:49:52 T:1475405976 NOTICE: Starting Kodi (15.2-RC1 Git:2015-08-28-59716ca). Platform: Android ARM 32-bit | |
21:49:52 T:1475405976 NOTICE: Using Release Kodi x32 build | |
21:49:52 T:1475405976 NOTICE: Kodi compiled Aug 28 2015 by GCC 4.8.0 for Android ARM 32-bit API level 17 (API level 17) | |
21:49:52 T:1475405976 NOTICE: Running on samsung GT-I9305 with Android 4.3.0 API level 18, kernel: Linux ARM 32-bit version 3.0.101 | |
21:49:52 T:1475405976 NOTICE: FFmpeg version: 2.6.4-kodi-2.6.4-Isengard | |
21:49:52 T:1475405976 NOTICE: Host CPU: ARMv7 Processor rev 0 (v7l), 4 cores available | |
21:49:52 T:1475405976 NOTICE: Product: m3xx, Device: m3, Board: smdk4x12 - Manufacturer: samsung, Brand: samsung, Model: GT-I9305, Hardware: smdk4x12 | |
21:49:52 T:1475405976 NOTICE: External storage path = /storage/emulated/0; status = ok |
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
root@elf:~# /usr/local/sbin/etcd --version | |
etcd Version: 2.3.3 | |
Git SHA: c41345d | |
Go Version: go1.6.2 | |
Go OS/Arch: linux/amd64 | |
root@tree:~# etcdctl --version | |
etcdctl version 2.3.3 | |
root@tree:~# fleetctl --version | |
fleetctl version 0.11.5 |
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
# dtrace -s macfuse_u_fuse_fs.d -c "fuse2fs /dev/disk2s1 /tmp/mnt -o rw,uid=$(id -u),gid=$(id -g),allow_other,debug -f" | |
and in another shell: | |
bash-5.0# cd /tmp/mnt/foo | |
bash-5.0# ls | |
bar.txt foo.txt zip.txt | |
bash-5.0# cat zip.txt | |
zip | |
bash-5.0# echo zip > zip.txt |
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
[cmdletbinding()] | |
Param( | |
[ValidateNotNull()] [string]$NameServer | |
) | |
$curStats = New-Object System.Xml.XmlDocument | |
$curStats.Load( $("http://"+$NameServer+"/xml/v3/server") ) | |
$output = "<prtg>`n" |
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
- block: | |
- name: Upgrade OS to latest LTS release | |
shell: | | |
test $(lsb_release -si) = Ubuntu || exit 0 | |
parted /dev/sda unit s print | awk ' | |
/^Disk \// { | |
total = substr($3,0,length($3)-1) | |
} | |
$5 == "extended" { | |
xpnum = $1 |
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/python3 | |
import requests, os, subprocess, platform, getpass, time | |
from requests.auth import HTTPBasicAuth | |
from requests.packages.urllib3.exceptions import InsecureRequestWarning | |
cluster_address = 'prism-central' | |
user = '' | |
passwd = '' |
OlderNewer