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
#### shell prompt color | |
export COLOR_NC='\e[0m' # No Color | |
export COLOR_WHITE='\e[1;37m' | |
export COLOR_BLACK='\e[0;30m' | |
export COLOR_BLUE='\e[0;34m' | |
export COLOR_LIGHT_BLUE='\e[1;34m' | |
export COLOR_GREEN='\e[0;32m' | |
export COLOR_LIGHT_GREEN='\e[1;32m' | |
export COLOR_CYAN='\e[0;36m' | |
export COLOR_LIGHT_CYAN='\e[1;36m' |
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 | |
## This script will read in configuration from azure_config.yml and spin up a VM instance | |
## it assumes you has a base image and data disk | |
## Suggestion on how to create a reusable image and use a persistent data disk | |
## 1. launch an instance with your selected image/OS, and attach a data disk to it | |
## 2. once instance is up and running, configure the OS and install the necessary libraries/packages | |
## 3. format the data disk, mount the disk, add the disk mounting information to fstab | |
## 4. tips: any folder (like $HOME/anaconda) that need frequent update, put it in data disk and symlink to your home directory. | |
## 5. once the instance is updated, shutdown the instance, and detach the data disk from the instance. |
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 | |
function parse_yaml { | |
config_file="azure_config.yml" | |
local prefix=$2 | |
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') | |
sed -ne "s|^\($s\):|\1|" \ | |
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ | |
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $config_file | | |
awk -F$fs '{ |
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
vm: | |
name: "" | |
resource: | |
group: "" | |
image: | |
name: "" | |
instance: | |
size: "" | |
ssh: | |
pubkey: "" |
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
// From https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/s3-example-presigned-urls.html | |
package main | |
import ( | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/s3" | |
"log" | |
"time" |
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" | |
) | |
type LeaveType string | |
const( | |
AnnualLeave LeaveType = "AnnualLeave" |
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
import React from 'react'; | |
import { toast } from 'react-toastify'; | |
toast('🦄 Wow so easy!', { | |
position: "top-right", | |
autoClose: 5000, | |
hideProgressBar: false, | |
closeOnClick: true, | |
pauseOnHover: true, | |
draggable: true, |
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
go test -run "^NameOfTest$" | |
go test -v foo_test.go foo.go |
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
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest | |
gocyclo -ignore "_test.go" . |
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
// Through Input | |
const [state, setState] = useState({ fName: "", lName: "" }); | |
const handleChange = e => { | |
const { name, value } = e.target; | |
setState(prevState => ({ | |
...prevState, | |
[name]: value | |
})); | |
}; |
OlderNewer