Skip to content

Instantly share code, notes, and snippets.

Endre Simo esimov

View GitHub Profile
@esimov
esimov / mandelbrot.go
Last active Mar 18, 2016
ASCII mandelbrot set generator
View mandelbrot.go
package main
import (
"fmt"
"github.com/shiena/ansicolor"
"os"
"sync"
)
const (
@esimov
esimov / xkcd.go
Created Feb 25, 2016
Simple Go program to download xkcd images to local disk
View xkcd.go
package main
import (
"fmt"
"net/http"
"encoding/json"
"strconv"
"os"
"log"
"io"
)
@esimov
esimov / resource_poller.go
Created Feb 2, 2016
Resource poller using goroutines
View resource_poller.go
package main
import (
"fmt"
"log"
"net/http"
"time"
)
const (
@esimov
esimov / goroutine_primes.go
Created Feb 1, 2016
Concurrent Prime Sieve using goroutines
View goroutine_primes.go
package main
import (
"fmt"
)
func main() {
prime := primes()
for {
@esimov
esimov / goroutine_ping_pong.go
Last active Jan 29, 2016
Ping-pong goroutine pattern
View goroutine_ping_pong.go
package main
import (
"time"
"fmt"
)
func main() {
var ball int
ch := make(chan int)
@esimov
esimov / goroutine_timer.go
Last active Jan 29, 2016
Timer goroutine pattern
View goroutine_timer.go
package main
import (
"fmt"
"time"
)
func main() {
for i := 0; i < 10; i++ {
ch := timer(1 * time.Second)
@esimov
esimov / goroutine_iterator.go
Created Jan 14, 2016
Goroutines iterator using WaitGroup
View goroutine_iterator.go
package main
import (
"fmt"
"sync"
"time"
)
func main() {
var ch chan int
@esimov
esimov / simplexnoise.js
Created Oct 6, 2014
Simplex noise implementation in Javascript
View simplexnoise.js
var NOISE = NOISE || { };
NOISE.Simplex = (function() {
var iOctaves = 1,
fPersistence = 0.5,
fResult, fFreq, fPers,
aOctFreq, // frequency per octave
aOctPers, // persistance per octave
fPersMax; // 1 / max persistence
@esimov
esimov / perlin.js
Created Oct 6, 2014
Perlin noise implementation in Javascript
View perlin.js
var NOISE = NOISE || { };
NOISE.Perlin = (function() {
var iOctaves = 1,
fPersistence = 0.2,
fResult, fFreq, fPers,
aOctFreq, // frequency per octave
aOctPers, // persistance per octave
fPersMax; // 1 / max persistence
@esimov
esimov / prime_goroutine.go
Last active Sep 26, 2018
Filter prime numbers in Go lang concurently using goroutines
View prime_goroutine.go
package main
import "fmt"
// Generate the input values passing through the go channel pipe
func generate(ch chan int) {
go func() {
for i := 2; ; i++ {
ch <- i
}
You can’t perform that action at this time.