Skip to content

Instantly share code, notes, and snippets.

@advincze
advincze / workdisp.go
Created Nov 26, 2014
work dispatcher
View workdisp.go
package main
import (
"fmt"
"sync"
"time"
)
func worker(id int, jobs <-chan int, results chan<- int) {
for j := range jobs {
View gist:a1b8d460868d6a045bb0
,_---~~~~~----._
_,,_,*^____ _____``*g*\"*,
/ __/ /' ^. / \ ^@q f
[ @f | @)) | | @)) l 0 _/
\`/ \~____ / __ \_____/ \
| _l__l_ I
} [______] I
] | | | |
] ~ ~ |
| |
@advincze
advincze / helloworld.go
Created May 7, 2013
golang hello world
View helloworld.go
package main
import (
"fmt"
)
func main(){
fmt.Println("Hello world!")
}
@advincze
advincze / gist:5664807
Last active Dec 17, 2015
angularjs share data state between service and controller
View gist:5664807
var myApp = angular.module('myApp', []);
myApp.factory('srv', function ($rootScope) {
srv = {
arr: []
};
var val = 1
setInterval(function () {
$rootScope.$apply(function () {
View new_gist_file
apply plugin: 'java'
apply plugin: 'idea'
repositories {
mavenCentral()
}
dependencies {
compile 'org.jsoup:jsoup:1.7.2'
testCompile group: 'junit', name: 'junit', version: '4.+'
@advincze
advincze / new_gist_file
Created Jun 13, 2013
mvn quickstart archetype
View new_gist_file
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart
View Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu-12.04"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
# Install Chef version 11
config.vm.provision :shell, :inline => <<EOS
set -e
if ! command -V chef-solo >/dev/null 2>/dev/null; then
curl -L https://www.opscode.com/chef/install.sh | bash -s -- -v 11.6.0
fi
@advincze
advincze / es.sh
Created Oct 20, 2013
install elasticsearch on debian/ubuntu
View es.sh
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.5.deb
sudo dpkg -i elasticsearch-0.90.5.deb
@advincze
advincze / main_test.go
Last active Jan 13, 2016
unmarshal full subtree as element
View main_test.go
package main
import (
"bytes"
"encoding/xml"
"io"
"log"
"testing"
)
View raffle.go
package main
import "fmt"
import "math/rand"
import "time"
func init() {
rand.Seed(time.Now().Unix())
}