Skip to content

Instantly share code, notes, and snippets.

Avatar

Andžej Maciusovič anjmao

View GitHub Profile
@anjmao
anjmao / myst_linux_client_tutorial.md
Last active Oct 9, 2019
Mysterium linux command line client
View myst_linux_client_tutorial.md
  1. Clone node source code.
git@github.com:mysteriumnetwork/node.git
cd node
  1. Compile node source code. You will need go compiler installed but don't be afraid as installing go is much easer than you may think. Download and install go.11 from here.
./bin/build
@anjmao
anjmao / go_tcp_proxy.go
Last active Aug 7, 2019
Simplest Go TCP proxy
View go_tcp_proxy.go
package main
import (
"flag"
"io"
"log"
"net"
)
var (
@anjmao
anjmao / wpool.go
Created Nov 12, 2018
Golang Worker Pool
View wpool.go
package wpool
import (
"sync"
)
// New returns new WorkerPool instance
func New(numOfWorkers int) *WorkerPool {
wp := &WorkerPool{
jobs: make(chan func()),
@anjmao
anjmao / langclient.ts
Created Aug 28, 2018
lsp-lang-client-socket
View langclient.ts
let serverOptions = () => {
let socket = net.connect({port: 4389});
let result = {
writer: socket,
reader: socket
};
return Promise.resolve(result);
};
const c = new LanguageClient('go-langserver', serverOptions, {})
View gist:078e50e045d13f1e72e57a7564d2d44b

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
View go-array-functions.go
package main
import "fmt"
func main() {
languages := []Language{
Language{ID: 1, Name: "Javascript", Rating: 9},
Language{ID: 2, Name: "Golang", Rating: 9},
Language{ID: 3, Name: "Python", Rating: 8},
Language{ID: 4, Name: "Rust", Rating: 8},
View go-filter-map.go
package main
import "fmt"
type Language struct {
ID int
Name string
Rating int
}
View js-filter-map.js
const languages = [
{ id: 1, name: 'Javascript', rating: 9 },
{ id: 1, name: 'Golang', rating: 9 },
{ id: 1, name: 'Python', rating: 8 },
{ id: 1, name: 'Rust', rating: 8 },
{ id: 1, name: 'C#', rating: 7 },
{ id: 1, name: 'Java', rating: 5 }
];
const bestLanguages = languages.filter(x => x.rating > 8).map(x => x.name);
View ng-snippets-webpack.js
module: {
rules: [
{
test: /\.ts$/,
loader: ['awesome-typescript-loader', 'angular2-template-loader', 'ng-snippets-loader'],
exclude: [/node_modules\/(?!(ng2-.+))/],
},
{
test: /\.(html)$/,
loader: ['raw-loader', 'ng-snippets-loader']
View ng-snippet-sample.html
---html,true
<ng-select [items]="items"
notFoundText="No results found"
typeToSearchText="Search for github account"
bindLabel="login"
[placeholder]="placeholder"
[multiple]="multiple"
[typeahead]="typeahead"
[(ngModel)]="githubAccount">
<ng-template ng-option-tmp let-item="item">
You can’t perform that action at this time.