Skip to content

Instantly share code, notes, and snippets.

View arindamroynitw's full-sized avatar

Arindam Roy arindamroynitw

View GitHub Profile
package main
import (
"fmt"
"time"
)
func main() {
t := time.Now()
formatted := t.Format(time.RFC1123)
package main
import (
"fmt"
"os"
"os/signal"
"time"
)
func main() {
@arindamroynitw
arindamroynitw / timing.go
Created September 29, 2019 10:14
Efficiently measuring execution time
package main
import (
"fmt"
"time"
)
func measureTime(funcName string) func() {
start := time.Now()
return func() {
@arindamroynitw
arindamroynitw / parallel.go
Created September 15, 2019 17:56
Parallel Execution
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
func main() {
@arindamroynitw
arindamroynitw / serial.go
Last active September 15, 2019 17:39
Serial Execution - Parallel Processing in Golang
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
@arindamroynitw
arindamroynitw / panic.go
Created September 15, 2019 09:43
Panic Recovery In Golang
package main
import "fmt"
func main() {
x := 20
y := 0
printAllOperations(x, y)
fmt.Println("Exiting main without any issues")
}
import static java.util.Calendar.*;
public class NewSwitch {
public static void main(String[] args) {
int numberOfDays = getNumberOfDays(MARCH);
System.out.println("The number of days in this month are " + numberOfDays);
}
import (
"testing"
)
func Test_keyOp_Degenerate(t *testing.T) {
type args struct {
s string
}
tests := []struct {
import (
"testing"
)
func Test_keyOp_Generate(t *testing.T) {
type args struct {
x int
y int
}
package main
import (
"fmt"
)
func main() {
op := ops.GetKeyOperator()