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
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04 | |
ENV NVIDIA_VISIBLE_DEVICES=all | |
ENV NVIDIA_DRIVER_CAPABILITIES=all | |
ENV DEBIAN_FRONTEND=noninteractive | |
# configure locale | |
ENV LANG en_US.UTF-8 | |
ENV LANGUAGE en_US:en | |
ENV LC_ALL en_US.UTF-8 |
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
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin | |
source /usr/share/bash-completion/bash_completion |
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" | |
type Board struct { | |
Numbers [][]int | |
} | |
func NewBoard(n [][]int) *Board { | |
return &Board{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
package bitformat | |
import ( | |
"fmt" | |
) | |
func bitFormat8(b uint8, places ...int) string { | |
return insertSep(fmt.Sprintf("%08b", b), places...) | |
} |
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" | |
"bytes" | |
"fmt" | |
"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
# In this script I'll use gotip, but there might be other ways | |
go install golang.org/dl/gotip@latest | |
# golang/go HEAD will be built | |
gotip download | |
# make sure gotip is available | |
gotip version | |
git clone https://github.com/golang/tools |
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
// RealIP sets the real client IP address to r.RemoteAddr. | |
// You must specify trustedIPs, which are the set of trusted IP address. | |
// For example, the IP address of LB, web server or reverse proxy should be in the set. | |
// When a malcious client sets X-Forwarded-For header with fake IP address, | |
// you cannot know which is the correct client's one without trustedIPs. | |
func RealIP(next http.Handler, trustedIPs []string) http.Handler { | |
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | |
xff := r.Header.Get("X-Forwarded-For") | |
if xff == "" { | |
next.ServeHTTP(w, r) |
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 | |
git clone https://github.com/vim/vim.git | |
cd vim | |
./configure \ | |
--enable-multibyte \ | |
--enable-nls \ | |
--enable-perlinterp \ | |
--enable-rubyinterp \ |
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 ( | |
"bytes" | |
"encoding/gob" | |
) | |
type Entry struct { | |
V interface{} | |
} |
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" | |
"flag" | |
"fmt" | |
"math/rand" | |
"os" | |
"strconv" | |
"strings" |
NewerOlder