Skip to content

Instantly share code, notes, and snippets.

@g14a
g14a / parallel.go
Last active December 5, 2021 07:58
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
"sync"
"time"
)
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<omp.h>
int main() {
int graph[200][200];
time_t t;
@g14a
g14a / sample.go
Last active October 10, 2018 14:55
package main
import (
"fmt"
"sync"
)
func main() {
ch := make(chan int)
package main
import "fmt"
func Generate(ch chan<- int) {
for i := 2; ; i++ {
ch <- i
}
}
package main
import (
"fmt"
)
func main() {
n := 2000
count := 0
// Chris Nauroth
// Intel Threading Challenge 2011
// Prime Sums
// This solution uses Intel Threading Building Blocks to set up a parallel
// pipeline consisting of 3 filters:
//
// 1. PrimeFunctor runs in serial and uses an implementation of the sieve of
// Eratosthenes to emit prime numbers.
//
<!DOCTYPE html>
<html>
<head>
<style>
body, html {
margin: 0;
height: 100%;
width: 100%;
}
/* Set the size of the div element that contains the map */
package main
import (
"net/http"
"github.com/rs/cors"
)
func main() {
c := cors.AllowAll()
@g14a
g14a / script.go
Last active February 16, 2021 14:11
package main
import (
"bytes"
"fmt"
"math/rand"
"os/exec"
"strconv"
"time"
)
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Animate a point</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=yes' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.45.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.45.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }