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
src := []int{1, 2, 3, 4, 5} | |
dst := make([]int, 5) | |
// copy from slice to slice | |
copied := copy(dst, src) | |
// copied: 5 | |
// dst: [1 2 3 4 5] | |
// copy from string to slice | |
var b = make([]byte, 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
// Usage | |
let logger = Logger("YakuterPackage.ViewController") | |
logger.info("Result: %{public}@", result) | |
logger.error("This is an error log") | |
// Logger.swift file content |
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
// Method 1 | |
struct User { | |
} | |
enum SecurityError: Error { | |
case emptyEmail | |
case emptyPassword | |
} |
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
// Versiyon 2 | |
package main | |
import "fmt" | |
type Foo struct{} | |
func main() { | |
a := &Foo{} | |
b := &Foo{} |
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
// Versiyon 1 | |
package main | |
import "fmt" | |
type Foo struct{} | |
func main() { | |
a := &Foo{} | |
b := &Foo{} |
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
// This example shows how to send files via pipe using multipart package | |
package main | |
import ( | |
"errors" | |
"fmt" | |
"io" | |
"mime/multipart" | |
"os" |
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
# distro prints the detected operating system including linux distros. | |
# Also parses ID_LIKE for common distro bases. | |
# | |
# Example outputs: | |
# - macos -> macos | |
# - freebsd -> freebsd | |
# - ubuntu, raspbian, debian ... -> debian | |
# - amzn, centos, rhel, fedora, ... -> fedora | |
# - opensuse-{leap,tumbleweed} -> opensuse | |
# - alpine -> alpine |
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
# Private Keys and Certificates in this file generated with the commands below | |
openssl genrsa 2048 > ca-key.pem | |
openssl req -new -x509 -nodes -days 365000 \ | |
-key ca-key.pem \ | |
-out ca-cert.pem \ | |
-addext "subjectAltName = IP:127.0.0.1" | |
openssl req -newkey rsa:2048 -nodes -days 365000 \ |
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 main() { | |
fs := token.NewFileSet() | |
f, err := parser.ParseFile(fs, "", "package main\nvar x int = 9\nfunc main(){b:=2}", parser.AllErrors) | |
if err != nil { | |
log.Fatal(err) | |
} | |
var v visitor | |
ast.Walk(v, f) | |
//fmt.Printf("%#v",f) | |
} |
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
// +build windows | |
package main | |
import ( | |
"crypto/x509" | |
"fmt" | |
"syscall" | |
"unsafe" | |
) |