Skip to content

Instantly share code, notes, and snippets.

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

Kief H. Shemul shemul

🏠
Working from home
  • TomTom, Delivery Hero
  • Amsterdam, Netherlands
View GitHub Profile
@shemul
shemul / prefix.cpp
Last active October 12, 2020 04:17
Infix_to_Prefix
# include <stdio.h>
# include <iostream>
# include <string.h>
# define MAX 20
using namespace std;
int top=-1;
char stack[MAX];
@shemul
shemul / go_generic.go
Created September 25, 2020 10:15
golang generic example
package main
import "fmt"
func reverse(arr []interface{}) interface{} {
var i = 0
var j = len(arr) - 1
for i < j {
tmp := arr[i]
@shemul
shemul / mips.go
Created September 22, 2020 07:55
mips.go
package main
import (
"fmt"
)
func main() {
fmt.Println("hello from the router")
}
@shemul
shemul / CArea.h
Created September 7, 2020 07:22
simple c program with external header file
struct CArea
{
int x;
int y;
} CArea;
double area(struct CArea area_samp)
{
return 0.5 * area_samp.x * area_samp.y;
}
@shemul
shemul / gcp_gke.tf
Created August 8, 2020 08:35
Google Cloud Platform - kubernetes engine using terraform
module "gke" {
source = "terraform-google-modules/kubernetes-engine/google"
project_id = "<PROJECT ID>"
name = "gke-test-1"
region = "us-central1"
zones = ["us-central1-a", "us-central1-b", "us-central1-f"]
network = "vpc-01"
subnetwork = "us-central1-01"
ip_range_pods = "us-central1-01-gke-01-pods"
ip_range_services = "us-central1-01-gke-01-services"
@shemul
shemul / mutex.go
Created July 16, 2020 19:26
Go Mutex
package main
import (
"fmt"
"sync"
)
var (
mutex = sync.Mutex{}
balance int
@shemul
shemul / .gitlab-ci.yml
Created July 12, 2020 16:52
gitlab-ci docker in docker host alias
image: shemul/gitlab-ci
variables:
DOCKER_TLS_CERTDIR: ""
stages:
- test
services:
- name: docker:dind
alias: dlocal
test:
stage: test
@shemul
shemul / Dockerfile
Created July 9, 2020 07:44
simple docker for gitlab CI. includes ssh, git, docker, docker-compose and go
FROM ubuntu:18.04
MAINTAINER Kief H. Shemul <theshemul@gmail.com>
# Update and upgrade repo
RUN apt-get update -y -q && apt-get upgrade -y -q
# Install tools we might need
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y -q curl build-essential ca-certificates git docker.io
RUN curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
RUN chmod +x /usr/local/bin/docker-compose
func GetMachineryServer() *machinery.Server {
Logger.Info("initing task server")
taskserver, err := machinery.NewServer(&config.Config{
Broker: "redis://localhost:6379",
ResultBackend: "redis://localhost:6379",
})
if err != nil {
Logger.Fatal(err.Error())
}
@shemul
shemul / tasks.go
Created June 13, 2020 17:42
go-machinery-task.go
package tasks
import (
"encoding/base64"
"encoding/json"
"log"
"net/smtp"
)
type Payload struct {