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 utils | |
import ( | |
"fmt" | |
"os" | |
"k8s.io/client-go/rest" | |
"k8s.io/client-go/tools/clientcmd" | |
) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Tetris</title> | |
<style> | |
body { | |
background-color: #222; | |
display: flex; | |
justify-content: center; | |
align-items: center; |
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 | |
# Check if both parameters are provided | |
if [ $# -ne 2 ]; then | |
echo "Usage: $0 <target_directory> <comma_separated_word_list>" | |
exit 1 | |
fi | |
target_dir="$1" | |
word_list=$(echo "$2" | tr ',' ' ') |
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 | |
# Function to print usage | |
print_usage() { | |
echo "Usage: $0 <github-repo> [branch]" | |
echo "Example: $0 go-gorm/gorm main" | |
echo "If branch is not specified, 'master' will be used as default." | |
} | |
# Check if at least a repository is provided |
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 attachable | |
import ( | |
"fmt" | |
"strings" | |
"sync" | |
) | |
// valuesAttached is a concurrent map to store values associated with pointer instances | |
var valuesAttached = sync.Map{} |
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
# PDF to Image Grid Conversion | |
magick convert -density 150 "your-pdf.pdf" -alpha remove -alpha off -background white -resize 1000x page_%d.png | |
magick montage page_*.png -tile 3x3 -geometry 1000x+10+10 -background gray output.png | |
# Some fun ... | |
magick convert -density 150 "your-pdf.pdf" -resize 1000x page_%d.png | |
magick convert -density 150 "your-pdf.pdf" -background white -resize 1000x -flatten output.png |
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
// MustConvertType converts an instance of type A to type B using JSON marshal and unmarshal. | |
// Both types A and B should have the same structure and JSON tags. | |
// In case of error, it panics. | |
func MustConvertType[A any, B any](input A) B { | |
var output B | |
// Marshal the input type A to JSON | |
data, err := json.Marshal(input) | |
if err != nil { | |
panic(fmt.Errorf("failed to marshal input: %w", err)) |
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" | |
"io/ioutil" | |
"net" | |
"net/http" | |
"net/url" |
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 ( | |
"flag" | |
"fmt" | |
"github.com/golang/glog" | |
"github.com/spf13/cobra" | |
"github.com/spf13/pflag" | |
) |
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
alias setp="export http_proxy=127.0.0.1:1087 && export https_proxy=127.0.0.1:1087" | |
alias unsetp="export http_proxy= && export https_proxy=" |
NewerOlder