Skip to content

Instantly share code, notes, and snippets.

View wuranbo's full-sized avatar
💭
wow, github can do this like social media?

吴冉波 wuranbo

💭
wow, github can do this like social media?
  • 20:32 (UTC +08:00)
View GitHub Profile
@NoraCodes
NoraCodes / work_queue.rs
Last active February 21, 2024 15:27
An example of a parallel work scheduling system using only the Rust standard library
// Here is an extremely simple version of work scheduling for multiple
// processors.
//
// The Problem:
// We have a lot of numbers that need to be math'ed. Doing this on one
// CPU core is slow. We have 4 CPU cores. We would thus like to use those
// cores to do math, because it will be a little less slow (ideally
// 4 times faster actually).
//
// The Solution:
package main
import "bytes"
import "io"
import "os"
import "strings"
import "strconv"
import "fmt"
import "flag"
import "net/http"
@vmarcinko
vmarcinko / EmbeddedKafkaCluster.java
Created August 16, 2014 13:34
Embedded Zookeeper & Kafka cluster
import kafka.server.KafkaConfig;
import kafka.server.KafkaServer;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
@jniltinho
jniltinho / myip.go
Created March 26, 2014 16:55
Get My IP Golang
package main
/*
URL: https://github.com/mccoyst/myip/blob/master/myip.go
URL: http://changsijay.com/2013/07/28/golang-get-ip-address/
*/
import (
"net"
"os"
@MoriTanosuke
MoriTanosuke / jekyll.groovy
Last active January 11, 2020 22:56
This is a simple post-receive-hook Groovy script for gitblit.
import com.gitblit.GitBlit
import com.gitblit.Keys
import com.gitblit.models.RepositoryModel
import com.gitblit.models.TeamModel
import com.gitblit.models.UserModel
import com.gitblit.utils.JGitUtils
import com.gitblit.utils.StringUtils
import java.text.SimpleDateFormat
import org.eclipse.jgit.api.CloneCommand
import org.eclipse.jgit.api.Git
@maliqq
maliqq / broker.go
Last active November 22, 2018 08:53
Golang message broker
package protocol
import (
"fmt"
"log"
)
// pubsub
type Broker struct {
Send map[string]*chan *Message
@definitelyMVP
definitelyMVP / LeaderLatchExample.java
Created February 19, 2013 10:33
a curator LeaderLatch example
import com.netflix.curator.framework.CuratorFramework;
import com.netflix.curator.framework.CuratorFrameworkFactory;
import com.netflix.curator.framework.recipes.leader.LeaderLatch;
import com.netflix.curator.framework.recipes.leader.Participant;
import com.netflix.curator.retry.ExponentialBackoffRetry;
import java.io.IOException;
/**
* @author yl