Skip to content

Instantly share code, notes, and snippets.

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

mohammad ali alidevhere

🏠
Working from home
View GitHub Profile
@alidevhere
alidevhere / sleep.go
Last active September 23, 2022 15:05
func sleepForWait(t time.Duration) {
for startTime := time.Now(); time.Since(startTime) < t; time.Sleep(10 * time.Second) {
if !*IsCampaigRunning {
// We use logrus for logging
logrus.Info("LEFT SLEEPING !!! IMMEDIATELY STOPING CAMPAIGNS PROCESSING")
return
}
}
}
// sleep function is updated as below
func sleepForWait(ctx context.Context,t time.Duration) {
select {
case <-ctx.Done():
return
case <-time.After(t):
return
}
}
@alidevhere
alidevhere / python-docker.yml
Last active November 13, 2022 15:23
we can't activate venv, we are doing what source activate will do
#FROM python:3.9-slim-bullseye
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install dependencies:
#COPY requirements.txt .
#RUN pip install -r requirements.txt
@alidevhere
alidevhere / update-golang.md
Created January 25, 2023 21:32 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

Turn on keyboard lights on ubuntu

Install brightnessctl

sudo apt update
sudo apt install brightnessctl

@alidevhere
alidevhere / gist:1cb1e05c2182bd671e4f5fe2e7ea2c37
Created March 7, 2023 18:05
Install Latest protocol buffer
https://lindevs.com/install-protoc-on-ubuntu