Skip to content

Instantly share code, notes, and snippets.

View secmohammed's full-sized avatar
:atom:

Mohammed Osama secmohammed

:atom:
View GitHub Profile
@secmohammed
secmohammed / bitbucket-pipelines.yml
Created August 2, 2023 20:17 — forked from carlok/bitbucket-pipelines.yml
How to force BitBucket to push a Docker image to AWS ECR after a git tag
#image: atlassian/default-image:2
image: python:3.7.3
pipelines:
tags:
'v*': # the tag is "vSomthing" like "v-0.4.2"
- step:
name: Build docker image and push to AWS ECR
services:
- docker
@secmohammed
secmohammed / cloudSettings
Created December 13, 2021 16:46 — forked from ahmedosama-st/cloudSettings
My MacOSX version of vscode settings
{"lastUpload":"2021-12-13T15:18:30.566Z","extensionVersion":"v3.4.3"}
@secmohammed
secmohammed / lockvschan_test.go
Created April 13, 2021 23:48 — forked from cyfdecyf/lockvschan_test.go
Performance test: mutex vs. channel in Go
// run with go test -test.bench Bench
package main
import (
// "fmt"
"runtime"
"sync"
"sync/atomic"
"testing"
@secmohammed
secmohammed / resp3.md
Created April 3, 2020 09:37 — forked from antirez/resp3.md
RESP3 protocol draft

RESP3 specification

Versions history:

  • 1.0, 2 May 2018, Initial draft to get community feedbacks.

Background

The Redis protocol has served us well in the past years, showing that, if carefully designed, a simple human readable protocol is not the bottleneck in the client server communication, and that the simplicity of the design is a major advantage in creating a healthy client libraries ecosystem.

Yet the Redis experience has shown that after about six years from its introduction (when it replaced the initial Redis protocol), the current RESP protocol could be improved, especially in order to make client implementations simpler and to support new features.

@secmohammed
secmohammed / structs_interface.go
Created January 21, 2020 13:47 — forked from josephspurrier/structs_interface.go
Golang - Understand Structs and Interfaces
// Also available at: https://play.golang.org/p/yTTpB5gB6C
package main
import (
"fmt"
)
// *****************************************************************************
// Example 1 - Struct vs Struct with Embedded Type
@secmohammed
secmohammed / ResolverWithMutation.ts
Created August 11, 2019 12:19
type-graphql validating inputs using yup instead of class-validator
```
const validationSchema = yup.object().shape({
email: yup
.string()
.min(3, emailNotLongEnough)
.max(255)
.email(invalidEmail)
.required(),
password: yup
.string()
@secmohammed
secmohammed / .zshrc
Last active May 6, 2019 12:30
zsh configuration
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/mohammed/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@secmohammed
secmohammed / gist:d2aeeee9ba18b68b8ec56cfd02b2e9c4
Last active March 10, 2019 01:42
How do I force “git pull” to overwrite local files?
First do a commit of your changes
git add *
git commit -a -m "local file server commit message"
Then fetch the changes and overwrite if there is a conflict
git fetch origin master
git merge -s recursive -X theirs origin/master
@secmohammed
secmohammed / laravel_exists_rule_snippet.md
Last active March 5, 2019 03:02
laravel exists rule validation
  • when using the Rule class to check on existence of specific record while validation , a query builder is being returned that can be used for nested checks
Rule::exists('addresses', 'id')->where(function($builder) {
  $builder->where('user_id', auth()->id());
})
                

That's an alternative to creating a couple of "exists" rule like the following: