Skip to content

Instantly share code, notes, and snippets.

View koolay's full-sized avatar
🏠
Working from home

koolay koolay

🏠
Working from home
  • Mars
View GitHub Profile
@cristaloleg
cristaloleg / golangci.yaml
Created March 28, 2023 07:01
Go linters configuration, the right version.
# See: https://olegk.dev/go-linters-configuration-the-right-version
run:
# Depends on your hardware, my laptop can survive 8 threads.
concurrency: 8
# I really care about the result, so I'm fine to wait for it.
timeout: 30m
# Fail if the error was met.
func compileInQuery(originalQuery string, argsWithInKeyword [][]interface{}, originalArg interface{}) (string, []interface{}, error) {
/**
capturing group result:
group 0: whole match
group 1: ([a-zA-Z_]+\.)?, table name
group 2: ([a-zA-Z_]+), column name
group 3: (NOT )?, NOT flag
*/
regex := regexp.MustCompile(`([a-zA-Z_]+\.)?([a-zA-Z_]+) ([Nn][Oo][Tt] )?[Ii][Nn] \(\?\?\?\)`)
match := regex.FindAllStringSubmatch(originalQuery, -1)
@dcwangmit01
dcwangmit01 / main.go
Last active March 2, 2024 14:54
Self-templating with golang text/template and gomplate
/*
Demo program illustrating usage of gomplate as a library.
This program will accept an input file and run it through the templating
engine as both the values dictionary as well as the template file. It will
repeat the process until the templating result stops changing, and print
the result to STDOUT.
This program add the gomplate datasources and functions to the golang
text/template engine. This requires the input to be have the gomplate
@ruanbekker
ruanbekker / setup-kubernetes-ubuntu-16.md
Last active October 21, 2023 08:25
Install a 3 Node Kubernetes Cluster on Ubuntu 16

Master: Dependencies

apt update && apt upgrade -y
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

cat <<EOF > /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
@itaysk
itaysk / prepull.yaml
Last active January 26, 2024 17:37
Kubernetes: Pre-pull images into node (moved to: https://github.com/itaysk/kube-imagepuller )
###
# There's a newer version available here:
# https://github.com/itaysk/kube-imagepuller
# All future updates will be made there.
# Please also post you questions as issues on that repo instead of commenting here
###
apiVersion: apps/v1beta2
kind: DaemonSet
@nikhita
nikhita / install-firacode.sh
Created April 24, 2017 17:32
How to install FiraCode font on Linux
mkdir -p ~/.local/share/fonts
for type in Bold Light Medium Regular Retina; do wget -O ~/.local/share/fonts/FiraCode-$type.ttf "https://github.com/tonsky/FiraCode/blob/master/distr/ttf/FiraCode-$type.ttf?raw=true"; done
fc-cache -f
@enzinier
enzinier / install_font_adobe_source_code_pro.sh
Created March 4, 2017 03:38
Install font Adobe Source Code Pro on Ubuntu 16.04 LTS
#!/bin/sh
# Userland mode (~$USER/), (~/).
# ~/.fonts is now deprecated and that
#FONT_HOME=~/.fonts
# ~/.local/share/fonts should be used instead
FONT_HOME=~/.local/share/fonts
echo "installing fonts at $PWD to $FONT_HOME"
mkdir -p "$FONT_HOME/adobe-fonts/source-code-pro"
@yaravind
yaravind / spark-rest-submit.sh
Last active October 30, 2020 02:43
Submit apps (SparkPi as e.g.) to spark cluster using rest api
curl -X POST -d http://master-host:6066/v1/submissions/create --header "Content-Type:application/json" --data '{
"action": "CreateSubmissionRequest",
"appResource": "hdfs://localhost:9000/user/spark-examples_2.11-2.0.0.jar",
"clientSparkVersion": "2.0.0",
"appArgs": [ "10" ],
"environmentVariables" : {
"SPARK_ENV_LOADED" : "1"
},
"mainClass": "org.apache.spark.examples.SparkPi",
"sparkProperties": {
@AdamIsrael
AdamIsrael / README.md
Last active May 20, 2019 02:44
Installing Juju 2.0 on Centos7

Juju 2.0 on Centos7

Configure epel repository

yum -y install epel-release
yum repolist

Install LXD

@schmohlio
schmohlio / sse.go
Last active February 13, 2023 08:38 — forked from ismasan/sse.go
Example SSE server in Golang
// v2 of the great example of SSE in go by @ismasan.
// includes fixes:
// * infinite loop ending in panic
// * closing a client twice
// * potentially blocked listen() from closing a connection during multiplex step.
package main
import (
"fmt"
"log"