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
func Add(args ...int64) (int64, error) {
sum := int64(0)
for _, arg := range args {
sum += arg
}
time.Sleep(time.Second * 5)
return sum, nil
}
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())
}
package main
import (
"os"
"github.com/RichardKnop/machinery/v1"
"github.com/shemul/go-machinery/server"
"github.com/shemul/go-machinery/utils"
"github.com/shemul/go-machinery/worker"
"github.com/urfave/cli"
├── go.mod
├── go.sum
├── main.go
├── server
│   └── server.go
├── tasks
│   └── tasks.go
├── utils
│   └── utils.go
└── worker
@shemul
shemul / gist:638d0ee92aa09d105a32218a7a31033b
Last active April 27, 2019 18:49 — forked from 7rin0/gist:ea890d2d4bf25a890b86aff01290e7d0
Docker exec root or default user
# Root.
$ docker exec -u 0 -it {container_id/image_name} bash
or
# Default container's user.
$ docker exec -it {container_id/image_name} bash
@shemul
shemul / gist:decc29cebcd994b5aac07d1db26bd293
Created November 20, 2018 20:46
Prometheus , node_exporter , grafana docker
# A scrape configuration scraping a Node Exporter and the Prometheus server
# itself.
scrape_configs:
# Scrape Prometheus itself every 5 seconds.
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
<?
// script to update local version of Google analytics script
// Remote file to download
$remoteFile = 'https://www.google-analytics.com/analytics.js';
$localfile = '/home/refinedseo/domain_name_with_tld/files/local-analytics.js';
//$localfile = '/home/refinedseo/public_html/domain_name_with_tld/wp-content/analytics.js';
//For Cpanel it will be /home/USERNAME/public_html/local-ga.js
// Connection time out
@shemul
shemul / cgpa_predictor.matlab
Created September 11, 2016 11:00
cgpa predictor analytics using matlab
function [trainedClassifier, validationAccuracy] = trainClassifier(trainingData)
% trainClassifier(trainingData)
% returns a trained classifier and its accuracy.
% This code recreates the classification model trained in
% Classification Learner app.
%
% Input:
% trainingData: the training data of same data type as imported
% in the app (table or matrix).
%
@shemul
shemul / pointInACircle.cpp
Created September 2, 2015 20:22
বৃত্তের ভিতরে বিন্দু ( Point Inside Circle )
/**<
problem : https://algo.codemarshal.org/problems/55184554742a2fff09a42faa
author : shemul
reference : https://www.youtube.com/watch?v=1-Q_BQ0ypmg
*/
#include<iostream>
#include<stdio.h>
@shemul
shemul / password.cpp
Created August 29, 2015 20:32
password_problem_in_prokriya.cpp
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include<stdlib.h>
using namespace std;