Skip to content

Instantly share code, notes, and snippets.

View majest's full-sized avatar

Artur Grabowski majest

  • http://arnetit.com
  • London
View GitHub Profile
@majest
majest / All found IT recruitment agencies in London
Last active September 17, 2016 15:15
All found IT recruitment agencies in London
24-7recruitment.net
OR 48digital.co.uk
OR a1people.net
OR abrs.com
OR acceler-it.com
OR adecco.com
OR alexanderash.com
OR alexanderblackrecruitment.co.uk
OR amoriabond.com
OR applauseit.co.uk
@majest
majest / go-compare-string
Created January 8, 2014 11:01
String comparing method in golang
func StringCompare(a, b string) int {
var min = len(b)
if len(a) < len(b) {
min = len(a)
}
var diff int
for i := 0; i < min && diff == 0; i++ {
diff = int(a[i]) - int(b[i])
}
if diff == 0 {
@majest
majest / go-http-server.go
Created February 9, 2015 12:27
go http server
package main
import (
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("./")))
http.ListenAndServe(":10000", nil)
}
exports.saveLog = function (userId, title, request, response, errors, type) {
var log = { userId: userId, title: title, status: 'ok', type: type };
log.details = { request: request, response: response };
if (errors != null && errors.length !== 0) {
log.details.response = errors;
log.type = type + '_error';
log.status = 'error';
}
@majest
majest / gist:f4f08d70bbcc17ac0aac
Last active August 29, 2015 14:26
Kubernetes on AWS + CoreOS
ami-50f4b927 - AMI for EU Ireland
Master : https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/coreos/cloud-configs/master.yaml
Node: https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/coreos/cloud-configs/node.yaml
ssh core@ip
kubectl run nginx --image=nginx
kubectl expose pod nginx-m7qjn --port=80 --public-ip="10.0.1.183"
package main
import (
"fmt"
"io"
"net/http"
"os"
"time"
"google.golang.org/grpc"

Keybase proof

I hereby claim:

  • I am majest on github.
  • I am majes (https://keybase.io/majes) on keybase.
  • I have a public key ASC9-Px7TYYw4PJ-zW5etzBX0wL1qzXOKrDJt1vk7Lws5Ao

To claim this, I am signing this object:

@majest
majest / makefile-env-vars
Created March 10, 2021 10:36
How to load environemnt variables in Makefile
# Makefile
This loads the env file and evaluates the export from it
so that those envs are available in environment and makefile itself.
It will try to load a file $path/.local.env
Good for the Makefile IF you DON'T use multiline vars
If you have multilines, use a different solution than loading env vars
via Makefile or `source .env` manually
```
@majest
majest / main.go
Last active August 15, 2023 23:49
Sqlite with GORM using UUID
package main
import (
"database/sql"
sqliteGo "github.com/mattn/go-sqlite3"
uuid "github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"gorm.io/gorm/logger"
IFS=
for command in go unzip git curl node npm
do
which $command &>/dev/null && echo "$command in path" || echo "$command NOT FOUND"
done
GEN_VERSION=1.25.0
GRPC_VERSION=1.26.0
GENGRPC_VERSION=1.0.1