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 temp | |
import ( | |
"errors" | |
"fmt" | |
"testing" | |
"time" | |
"github.com/stretchr/testify/require" | |
) |
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
{ | |
"prettier": { | |
"arrowParens": "always", | |
"bracketSpacing": true, | |
"endOfLine": "lf", | |
"htmlWhitespaceSensitivity": "css", | |
"jsxBracketSameLine": false, | |
"jsxSingleQuote": false, | |
"semi": true, | |
"singleQuote": true, |
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
// SEVEY: Handle directory rename | |
if build.Release != "testing" { | |
f, err := os.Open(filepath.Join(r.persistDir, "dirpaths")) | |
if err != nil { | |
return nil, errors.AddContext(err, "unable to open dirpaths file") | |
} | |
urp := r.newUniqueRefreshPaths() | |
r.log.Println("SEVEY: Reading dirs") | |
totalDirs := 0 | |
scanner := bufio.NewScanner(f) |
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
// parsePercentages takes a range of floats and returns them rounded to | |
// percentages that add up to 100. They will be returned in the same order that | |
// they were provided | |
func parsePercentages(values []float64) []float64 { | |
// Create a slice of percentInfo to track information of the values in the | |
// slice and calculate the subTotal of the floor values | |
type percentInfo struct { | |
index int | |
floorVal float64 | |
originalVal float64 |
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
// TestSiaTest is an example of how to structure a test using the siatest | |
// package | |
// | |
// The testnodes created with the TestGroup can access all the client | |
// package methods as well as a number of helper siatest methods for common | |
// tasks. | |
func TestSiaTest(t *testing.T) { | |
// These integration tests can take some time and so should be run with a | |
// longer timeout | |
if testing.Short() { |
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" | |
"gitlab.com/NebulousLabs/fastrand" | |
) | |
func main() { | |
slice := generateIntSlice(20) |
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" | |
"gitlab.com/NebulousLabs/fastrand" | |
) | |
func main() { | |
slice := generateIntSlice(20) |
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" | |
// mergeSort splits an array into sub arrays until they are of length 1. A | |
// length 1 array is sorted. Then the sorted arrays are merged | |
func mergeSort(arr []int) []int { | |
// If an array has a length of one then it is sorted | |
length := len(arr) | |
if length <= 1 { |
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 | |
// This code is for creating copies of a clean Sia node and initiallizing the | |
// wallet, sending Siacoins to it, setting an allowance, and waiting for | |
// contracts to form. | |
// For this context, a clean Sia node is defined as a node that was created with | |
// ./siad and allowed to fully sync. No other commands or initialization took | |
// place. |
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
### Keybase proof | |
I hereby claim: | |
* I am msevey on github. | |
* I am sevey (https://keybase.io/sevey) on keybase. | |
* I have a public key ASBgPwBkubkckUaXx6C1e_qWKmw351gVCmxyLVkpqZ4s-Qo | |
To claim this, I am signing this object: |