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 | |
COMMAND=$@ | |
DIR=$PWD | |
function block_for_change { | |
inotifywait -q -q -r -e modify $DIR | |
} | |
function kill_command { |
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
// Return a random int between min and max. | |
func RandRange(min, max int) int { | |
return rand.Intn(max-min+1) + min | |
} | |
// Return a random float between 0.0 and max. | |
func RandRangeFloat(max float64) float64{ | |
return rand.Float64() * max | |
} |
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" | |
"sort" | |
) | |
// Our custom struct to sort. | |
type Data struct { | |
Name string |
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 ( | |
"bufio" | |
"fmt" | |
"io" | |
"os" | |
) | |
func main() { |
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" | |
"io/ioutil" | |
"strings" | |
"golang.org/x/text/encoding/charmap" | |
) |
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 | |
func RoundPrec(x float64, prec int) float64 { | |
if math.IsNaN(x) || math.IsInf(x, 0) { | |
return x | |
} | |
sign := 1.0 | |
if x < 0 { |
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 ( | |
"os" | |
"os/exec" | |
) | |
// Start a new terminal/bash session in specified path. | |
func session(path string) { | |
os.Chdir(path) |
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 | |
EMAIL="[email protected]" | |
LEGOROOT="/path/to/lego" | |
function renew { | |
domain="$1" | |
path="$2" | |
$LEGOROOT/lego --key-type rsa4096 --accept-tos --path "$LEGOROOT/.lego" --email "$EMAIL" \ |
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
ssl_certificate /etc/nginx/ssl/DOMAIN.crt; | |
ssl_certificate_key /etc/nginx/ssl/DOMAIN.key; | |
ssl_session_timeout 1d; | |
ssl_session_cache shared:SSL:50m; | |
ssl_session_tickets off; | |
ssl_prefer_server_ciphers on; | |
ssl_protocols TLSv1.2; | |
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256'; | |
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 leven | |
import "github.com/arbovm/levenshtein" | |
func calcScore(a, b string) float64 { | |
score := levenshtein.Distance(a, b) | |
lena := len(a) | |
lenb := len(b) | |
var bigger float64 |
OlderNewer