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
requiredPrograms := []string{"nc", "ls", "bash", "mkdir"} | |
var requiredapps [4]bool | |
for i, s := range requiredPrograms { | |
// Get path of required programs | |
path, err := exec.LookPath(s) | |
if err == nil { | |
fmt.Printf("Required program %v %v found at %v\n", i+1, s, path) | |
requiredapps[i] = true //save to array | |
} else { | |
fmt.Printf("Required program %v %v cannot found.\n", i+1, s) |
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
ipv6_regex := `^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$` | |
ipv4_regex := `^(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})` | |
domain_regex := `^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$` | |
match, _ := regexp.MatchString(ipv4_regex+`|`+ipv6_regex+`|`+domain_regex, host) | |
if match { | |
fmt.Println("Input is valid") | |
} else { | |
fmt.Println("Given input does not match") | |
re |
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
#!/bin/bash | |
# Gocker is my docker alias to create temporarily conteiner to test go aplications. | |
# You can find alias https://gist.github.com/ahmetozer/cf32f7f3a8cc9ad0f4ee83765649a1dc | |
while inotifywait -r -q -e modify,create,delete,move . | |
do | |
killall go | |
kill -9 `netstat -ltnp | grep -v -E "Program name" | grep -v "Active Internet connections (only servers)" | cut -d"N" -f2 |sed 's/ //g' | cut -d"/" -f1` > /dev/null | |
go run *.go & | |
done |
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
[url "ssh://[email protected]/"] | |
insteadOf = https://github.com/ | |
[url "ssh://[email protected]/"] | |
insteadOf = https://gitlab.com/ | |
[url "ssh://[email protected]/"] | |
insteadOf = https://bitbucket.org/ |
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
port_regex="^((6553[0-5])|(655[0-2][0-9])|(65[0-4][0-9]{2})|(6[0-4][0-9]{3})|([1-5][0-9]{4})|([1-9][0-9]{3})|([1-9][0-9]{2})|([1-9][0-9])|([1-9]))$" | |
user_regex="^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$" |
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
server { | |
listen 443 http2 ssl; | |
listen [::]:443 http2 ssl; | |
server_name yourdomain; | |
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt; | |
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key; | |
ssl_dhparam /etc/ssl/certs/dhparam.pem; |
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
stream { | |
server { | |
listen 443 ssl; | |
proxy_pass my.local.application:80; | |
ssl_certificate /etc/ssl/certs/server.crt; | |
ssl_certificate_key /etc/ssl/certs/server.key; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers HIGH:!aNULL:!MD5; | |
ssl_session_cache shared:SSL:20m; |
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
package main | |
import ( | |
// "fmt" | |
"os/exec" | |
"os" | |
) | |
func main() { | |
topCommand := exec.Command("top","-d 0.5", "-b", "-n 5") |
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
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) | |
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). | |
# To use --mount type=bind,source=/root/docker.profile,target=/root/.bashrc,readonly argument on your docker run command | |
if [ "${PS1-}" ]; then | |
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then | |
# The file bash.bashrc already sets the default PS1. | |
# PS1='\h:\w\$ ' | |
if [ -f /etc/bash.bashrc ]; then |
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
git_profile_url='github.com/AhmetOZER' | |
alias gocker='docker run -it --rm -v $(pwd):/go/src/$git_profile_url/golang/$(basename $(pwd)) golang' |