Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View anjmao's full-sized avatar

Andžej Maciusovič anjmao

  • CAST AI
  • Lithuania, Vilnius
View GitHub Profile
@anjmao
anjmao / security-context-capabilities.yaml
Last active December 11, 2023 14:34
Kubernetes security context all capabilities
apiVersion: v1
kind: Pod
metadata:
name: security-context-capabilities
spec:
containers:
- name: example
image: gcr.io/google-samples/node-hello:1.0
securityContext:
capabilities:
@anjmao
anjmao / skbtracer.c
Created July 28, 2022 19:22 — forked from chendotjs/skbtracer.c
ebpf-skbtracer
#include <bcc/proto.h>
#include <uapi/linux/ip.h>
#include <uapi/linux/ipv6.h>
#include <uapi/linux/icmp.h>
#include <uapi/linux/tcp.h>
#include <uapi/linux/udp.h>
#include <uapi/linux/icmpv6.h>
#include <net/inet_sock.h>
#include <linux/netfilter/x_tables.h>
@anjmao
anjmao / create.sh
Created April 15, 2022 12:40 — forked from saumas/create.sh
Create an admin kubeconfig
#!/usr/bin/env bash
set -ex
kubectl create serviceaccount admin
kubectl create clusterrolebinding admin --clusterrole=cluster-admin --serviceaccount=default:admin
SECRET_NAME=$(kubectl get sa admin -o=jsonpath='{.secrets[0].name}')
TOKEN=$(kubectl get secret "${SECRET_NAME}" -ojsonpath='{.data.token}' | base64 -d)
CA=$(kubectl get secret "${SECRET_NAME}" -ojsonpath='{.data.ca\.crt}')
CURRENT_CONTEXT=$(kubectl config current-context)
@anjmao
anjmao / main.go
Created March 15, 2021 07:59
Graph DFS and BFS in Go
package main
import (
"fmt"
"testing"
)
type Graph struct {
Nodes map[string][]string
}
@anjmao
anjmao / install_go_1_15.sh
Created December 12, 2020 20:00
Linux Go Install
#!/bin/bash
set -e
wget https://golang.org/dl/go1.15.6.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.15.6.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> $HOME/.profile
@anjmao
anjmao / myst_linux_client_tutorial.md
Last active October 9, 2019 07:28
Mysterium linux command line client
  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 August 7, 2019 10:30
Simplest Go TCP proxy
package main
import (
"flag"
"io"
"log"
"net"
)
var (
@anjmao
anjmao / wpool.go
Created November 12, 2018 14:21
Golang Worker Pool
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 August 28, 2018 18:15
lsp-lang-client-socket
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, {})
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},