Skip to content

Instantly share code, notes, and snippets.

@advincze
advincze / helloworld.go
Created May 7, 2013 07:21
golang hello world
package main
import (
"fmt"
)
func main(){
fmt.Println("Hello world!")
}
@advincze
advincze / gist:5664807
Last active December 17, 2015 19:59
angularjs share data state between service and controller
var myApp = angular.module('myApp', []);
myApp.factory('srv', function ($rootScope) {
srv = {
arr: []
};
var val = 1
setInterval(function () {
$rootScope.$apply(function () {
@advincze
advincze / new_gist_file
Created June 12, 2013 18:45
simple gradle
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 June 13, 2013 12:22
mvn quickstart archetype
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart
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 October 20, 2013 09:30
install elasticsearch on debian/ubuntu
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 / workdisp.go
Created November 26, 2014 07:01
work dispatcher
package main
import (
"fmt"
"sync"
"time"
)
func worker(id int, jobs <-chan int, results chan<- int) {
for j := range jobs {
,_---~~~~~----._
_,,_,*^____ _____``*g*\"*,
/ __/ /' ^. / \ ^@q f
[ @f | @)) | | @)) l 0 _/
\`/ \~____ / __ \_____/ \
| _l__l_ I
} [______] I
] | | | |
] ~ ~ |
| |
@advincze
advincze / main_test.go
Last active January 13, 2016 07:28
unmarshal full subtree as element
package main
import (
"bytes"
"encoding/xml"
"io"
"log"
"testing"
)
@advincze
advincze / raffle.go
Created June 7, 2016 03:25
raffle.go
package main
import "fmt"
import "math/rand"
import "time"
func init() {
rand.Seed(time.Now().Unix())
}